正文
增加 18 行删除 18 行
13 行未改动14151617181920212213 行未改动3637383940414243449 行未改动545556575859606162636465666768697013 行未改动8485868788899091928 行未改动10110210310410510610710810911011111211311411521 行未改动13713813914014114214314414514614714824 行未改动17317417517617717817918018118218344 行未改动2282292302312322332342352362377 行未改动24524624724824925025125225313 行未改动26726826927027127227327413 行未改动**分数:** $310$分。## [T3](https://www.luogu.com.cn/problem/B3667): B3667 求区间所有后缀最大值的位置源代码:```cpp#include<bits/stdc++.h>#define int long long13 行未改动q.pop_front();}cout << '\n';return ;}signed main(){ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);cin >> n >> m;for(int i = 1; i <= n; ++i){9 行未改动}return 0;}```错误原因:```cppwhile(!q.empty() && a[q.back()] <= a[i]) q.pop_back();while(!q.empty() && q.front() + m - 1 < i) q.pop_front();```正确思路:应该先把前面的给砍掉,再把后面的接进来,因为如果先把后面接进来的话,那么后缀最大值可能就会比原本得到的值要不一样。还要注意一点:$1 \le x_i \le 2^{64}$## AC Code:```cpp#include<bits/stdc++.h>#define int unsigned long long13 行未改动q.pop_front();}cout << '\n';return ;}signed main(){ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);cin >> n >> m;for(int i = 1; i <= n; ++i){8 行未改动//cout << "->\n";}return 0;}```## [T5](https://www.luogu.com.cn/problem/P3467): P3467 [POI 2008] PLA-Postering源代码:```cpp#include<bits/stdc++.h>#define int long long21 行未改动return 0;}```错误原因:离谱正确思路:这道题老师上课讲过了,我不多说了。## AC Code:```cpp#include<bits/stdc++.h>#define int long long24 行未改动```## [T6](https://www.luogu.com.cn/problem/P2564): P2564 [SCOI2009] 生日礼物正确思路:这题跟逛画展那道题唯一的区别就是这里还需要自己把题目给的条件捋成一条数轴,别的没有区别。上代码。## AC Code:```cpp#include<bits/stdc++.h>#define int long long#define p first44 行未改动## [T7](https://www.luogu.com.cn/problem/P1823): P1823 [COI 2007] Patrik 音乐会的等待大概说一下思路,这道题目他需要先乘除一个node,然后如果判断站点比ai要小的话,那么就把站点排除并且 Answer加等于站顶并且弹出站顶,然后如果再判断站点和ai相等,那么就把node给改变别的没了。## AC Code:```cpp#include<bits/stdc++.h>#define int long long7 行未改动struct P{int x, y;}node;stack<P> st;signed main(){ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);cin >> n;for(int i = 1; i <= n; ++i){13 行未改动}cout << ans;return 0;}```> 乾坤未定,你我皆是黑马······13 行未改动14151617181920212213 行未改动3637383940414243449 行未改动545556575859606162636465666768697013 行未改动8485868788899091928 行未改动10110210310410510610710810911011111211311411521 行未改动13713813914014114214314414514614714824 行未改动17317417517617717817918018118218344 行未改动2282292302312322332342352362377 行未改动24524624724824925025125225313 行未改动26726826927027127227327413 行未改动**分数:** $310$分。## [T3](https://www.luogu.com.cn/problem/B3667): B3667 求区间所有后缀最大值的位置源代码:```cpp#include<bits/stdc++.h>#define int long long13 行未改动q.pop_front();}cout << '\n';return ;}signed main(){ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);cin >> n >> m;for(int i = 1; i <= n; ++i){9 行未改动}return 0;}```错误原因:```cppwhile(!q.empty() && a[q.back()] <= a[i]) q.pop_back();while(!q.empty() && q.front() + m - 1 < i) q.pop_front();```正确思路:应该先把前面的给砍掉,再把后面的接进来,因为如果先把后面接进来的话,那么后缀最大值可能就会比原本得到的值要不一样。还要注意一点:$1 \le x_i \le 2^{64}$## AC Code:```cpp#include<bits/stdc++.h>#define int unsigned long long13 行未改动q.pop_front();}cout << '\n';return ;}signed main(){ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);cin >> n >> m;for(int i = 1; i <= n; ++i){8 行未改动//cout << "->\n";}return 0;}```## [T5](https://www.luogu.com.cn/problem/P3467): P3467 [POI 2008] PLA-Postering源代码:```cpp#include<bits/stdc++.h>#define int long long21 行未改动return 0;}```错误原因:离谱正确思路:这道题老师上课讲过了,我不多说了。## AC Code:```cpp#include<bits/stdc++.h>#define int long long24 行未改动```## [T6](https://www.luogu.com.cn/problem/P2564): P2564 [SCOI2009] 生日礼物正确思路:这题跟逛画展那道题唯一的区别就是这里还需要自己把题目给的条件捋成一条数轴,别的没有区别。上代码。## AC Code:```cpp#include<bits/stdc++.h>#define int long long#define p first44 行未改动## [T7](https://www.luogu.com.cn/problem/P1823): P1823 [COI 2007] Patrik 音乐会的等待大概说一下思路,这道题目他需要先乘除一个node,然后如果判断站点比ai要小的话,那么就把站点排除并且 Answer加等于站顶并且弹出站顶,然后如果再判断站点和ai相等,那么就把node给改变别的没了。## AC Code:```cpp#include<bits/stdc++.h>#define int long long7 行未改动struct P{int x, y;}node;stack<P> st;signed main(){ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);cin >> n;for(int i = 1; i <= n; ++i){13 行未改动}cout << ans;return 0;}```> 乾坤未定,你我皆是黑马······