# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
714824 | 2023-03-25T10:09:59 Z | BidoTeima | 지구 온난화 (NOI13_gw) | C++17 | 1000 ms | 65536 KB |
/* ID: BidoTeima LANG: C++11 TASK: */ #include <bits/stdc++.h> using namespace std; using ll = long long; void moo(string filename); void ACPLS(string str = "") { if(str=="NOF")return; if(str.size() && str != "IIOT") moo(str); else if(str != "IIOT"){ #ifndef ONLINE_JUDGE freopen("output.txt", "w", stdout); freopen("input.txt", "r", stdin); #endif } ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } void moo(string fileName){ freopen((fileName+".in").c_str(),"r",stdin); freopen((fileName+".out").c_str(),"w",stdout); } #define tcccc \ int tttttt/*,subtask*/; \ cin >> tttttt/* >> subtask*/; \ while (tttttt--)/*end */ int main() { //ACPLS(""); int n; cin>>n; n += 2; int a[n], cur = 1; a[0] = 0; for(int i = 1; i < n - 1; i++){ cin>>a[i]; } a[n - 1] = 0; vector<int>c; for(int i = 0; i < n; i++){ if(i && a[i] == a[i - 1])continue; c.push_back(a[i]); } n = (int)c.size(); map<int,vector<int>>mp{}; for(int i = 0; i < n; i++){ mp[c[i]].push_back(i); } int ans = 1; for(auto&it:mp){ int x = it.first; if(!x)continue; vector<int>&v = it.second; for(int i = 0; i < (int)v.size(); i++){ assert(v[i] - 1 >= 0); assert(v[i] + 1 < n); int val = (c[v[i] - 1] < x) + (c[v[i] + 1] < x); if(val == 0){ cur++; } else if(val == 2){ cur--; } } ans = max(ans, cur); } cout<<ans<<'\n'; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 1824 KB | Output is correct |
2 | Correct | 22 ms | 1692 KB | Output is correct |
3 | Correct | 19 ms | 1568 KB | Output is correct |
4 | Correct | 22 ms | 1704 KB | Output is correct |
5 | Correct | 23 ms | 1656 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 127 ms | 11920 KB | Output is correct |
2 | Correct | 66 ms | 11928 KB | Output is correct |
3 | Correct | 126 ms | 12000 KB | Output is correct |
4 | Correct | 108 ms | 11928 KB | Output is correct |
5 | Correct | 105 ms | 11924 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 868 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1068 ms | 61040 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |