# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
84329 | 2018-11-14T11:38:09 Z | zoooma13 | Baloni (COCI15_baloni) | C++14 | 2000 ms | 132096 KB |
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define MAX_N 1000006 int N; vector <int> A; set<int> os[MAX_N]; multiset <int> ms; int main() { scanf("%d",&N); assert(N < MAX_N); A.resize(N ,0); for(int i=0; i<N; i++) { scanf("%d",&A[i]); os[A[i]].insert(i); ms.insert(A[i]); } int Ans = 0; set<int>::iterator it; while(!ms.empty()) { int i = *prev(ms.end()); int j = -1; while(true) { it = os[i].upper_bound(j); if(it == os[i].end()) break; j = *it; ms.erase(ms.find(i)); os[i].erase(it); i--; } Ans++; } cout << Ans << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 45 ms | 47352 KB | Output is correct |
2 | Correct | 48 ms | 47612 KB | Output is correct |
3 | Correct | 49 ms | 47820 KB | Output is correct |
4 | Correct | 49 ms | 47864 KB | Output is correct |
5 | Execution timed out | 2064 ms | 128588 KB | Time limit exceeded |
6 | Runtime error | 1655 ms | 132096 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
7 | Execution timed out | 2080 ms | 132096 KB | Time limit exceeded |
8 | Execution timed out | 2074 ms | 132096 KB | Time limit exceeded |
9 | Execution timed out | 2055 ms | 132096 KB | Time limit exceeded |
10 | Execution timed out | 2069 ms | 132096 KB | Time limit exceeded |