# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
714820 | 2023-03-25T10:07:14 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++){ 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 | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 308 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 300 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 1868 KB | Output is correct |
2 | Correct | 19 ms | 1824 KB | Output is correct |
3 | Correct | 22 ms | 1824 KB | Output is correct |
4 | Correct | 19 ms | 1960 KB | Output is correct |
5 | Correct | 18 ms | 1960 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 96 ms | 12816 KB | Output is correct |
2 | Correct | 59 ms | 12612 KB | Output is correct |
3 | Correct | 103 ms | 12768 KB | Output is correct |
4 | Correct | 118 ms | 12772 KB | Output is correct |
5 | Correct | 89 ms | 12796 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 773 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1070 ms | 65536 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |