# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
477866 | 2021-10-04T09:26:59 Z | sumit_kk10 | Global Warming (NOI13_gw) | C++17 | 1000 ms | 33984 KB |
#include <bits/stdc++.h> #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL) #define ll long long int #define ld long double using namespace std; const int N = 1e6 + 5; const int MOD = 1e9 + 7; void solve(){ int n; cin >> n; vector<long long> a(n); for(int i = 0; i < n; ++i) cin >> a[i]; vector<pair<long long, int> > comp; for(int i = 0; i < a.size(); ++i) comp.push_back({a[i], i}); sort(comp.begin(), comp.end()); int ct = 1; a[comp[0].second] = ct; for(int i = 1; i < comp.size(); ++i){ if(comp[i].first != comp[i - 1].first) ++ct; a[comp[i].second] = ct; } int ans = 0; for(int i = 1; i <= ct; ++i){ int x = 0; for(int j = 1; j <= n; ++j){ int cur = j; while(a[cur] > i) ++cur; if(cur != j){ j = cur - 1; ++x; } } ans = max(ans, x); } cout << ans << "\n"; } int main(){ fast; int t = 1; // cin >> t; while(t--) solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 336 KB | Output is correct |
2 | Incorrect | 3 ms | 320 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 3532 KB | Output is correct |
2 | Correct | 27 ms | 3532 KB | Output is correct |
3 | Correct | 28 ms | 3528 KB | Output is correct |
4 | Correct | 30 ms | 3532 KB | Output is correct |
5 | Correct | 27 ms | 3512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1078 ms | 4044 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1085 ms | 33984 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1094 ms | 33332 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |