# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
273072 | 2020-08-19T03:46:10 Z | T0p_ | Global Warming (NOI13_gw) | C++14 | 1000 ms | 17012 KB |
#include<bits/stdc++.h> using namespace std; int n; long long h[1001000]; vector<long long> v; int solve(long long x) { bool ch = x < h[1]; int ret = 0; for(int i=2 ; i<=n ; i++) { if(x < h[i]) ch = true; else { if(ch) { ch = false; ret++; } } } if(ch) ret++; return ret; } int main() { scanf(" %d",&n); for(int i=1 ; i<=n ; i++) { scanf(" %lld",&h[i]); v.push_back(h[i]); } sort(v.begin(), v.end()); int l = 0, r = n-1; while(l != r) { int mid = (l+r+1)>>1; int ll = 0, rr = mid; while(ll != rr) { int mm = (ll+rr+1)>>1; (solve(v[mm]) != solve(v[mid])) ? ll = mm : rr = mm-1; } (solve(v[ll]) <= solve(v[mid])) ? l = mid : r = mid-1; } printf("%d\n",solve(v[l])); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 347 ms | 2296 KB | Output is correct |
2 | Correct | 318 ms | 2296 KB | Output is correct |
3 | Correct | 334 ms | 2296 KB | Output is correct |
4 | Correct | 344 ms | 2296 KB | Output is correct |
5 | Correct | 341 ms | 2296 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 287 ms | 2944 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1081 ms | 17012 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1073 ms | 16976 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |