# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
633578 | 2022-08-22T18:44:02 Z | Ahmed57 | Global Warming (NOI13_gw) | C++14 | 1000 ms | 65536 KB |
#include <bits/stdc++.h> using namespace std; long long n; long long pre[2000005]; vector<long long> w,s; map<long long,long long> cmp; int main(){ cin>>n; int la = 2; for(int i = 0;i<n;i++){ long long x;cin>>x; w.push_back(x); s.push_back(x); } sort(s.begin(),s.end()); long long z = 1; for(int i = 0;i<n;i++){ if(i&&s[i]==s[i-1])z--; cmp[s[i]] = ++z; } for(int i = 0;i<w.size();i++){ if(la<cmp[w[i]]*2){ pre[la]++; pre[cmp[w[i]]*2]--; } la = cmp[w[i]]*2; } long long ma = 0 , cur = 0; for(int i = 2;i<=z*2;i++){ cur+=pre[i]; ma = max(ma,cur); } cout<<ma<<"\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 2076 KB | Output is correct |
2 | Correct | 24 ms | 1992 KB | Output is correct |
3 | Correct | 23 ms | 2012 KB | Output is correct |
4 | Correct | 22 ms | 1992 KB | Output is correct |
5 | Correct | 22 ms | 1992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 114 ms | 9572 KB | Output is correct |
2 | Correct | 71 ms | 9636 KB | Output is correct |
3 | Correct | 140 ms | 9584 KB | Output is correct |
4 | Correct | 126 ms | 9636 KB | Output is correct |
5 | Correct | 112 ms | 9660 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 647 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1096 ms | 60568 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |