# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43960 | 2018-03-29T00:37:06 Z | IvanC | Kralj (COCI16_kralj) | C++17 | 2000 ms | 82908 KB |
#include <bits/stdc++.h> #define LSOne(S) (S & (-S)) using namespace std; const int MAXN = 1e6 + 10; int Dwarves[MAXN],A[MAXN],N,exibe; set<int> Elves,Mesa; int main(){ scanf("%d",&N); for(int i = 1;i<=N;i++){ scanf("%d",&A[i]); Mesa.insert(i); Mesa.insert(i+N); } for(int i = 1;i<=N;i++){ scanf("%d",&Dwarves[i]); } for(int i = 1;i<=N;i++){ int x; scanf("%d",&x); Elves.insert(x); } for(int vez = 1;vez<=N;vez++){ int posicao = *Mesa.lower_bound(A[vez]); if(posicao > N) posicao -= N; Mesa.erase(posicao); Mesa.erase(posicao+N); int dwarf = Dwarves[posicao]; if((*Elves.rbegin()) < dwarf){ Elves.erase(Elves.begin()); } else{ exibe++; Elves.erase(Elves.lower_bound(dwarf)); } //printf("Vez %d\n",vez); } printf("%d\n",exibe); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1702 ms | 67864 KB | Output is correct |
2 | Correct | 1214 ms | 67864 KB | Output is correct |
3 | Correct | 1481 ms | 80820 KB | Output is correct |
4 | Correct | 1472 ms | 82624 KB | Output is correct |
5 | Execution timed out | 2079 ms | 82624 KB | Time limit exceeded |
6 | Execution timed out | 2025 ms | 82624 KB | Time limit exceeded |
7 | Execution timed out | 2075 ms | 82624 KB | Time limit exceeded |
8 | Execution timed out | 2077 ms | 82624 KB | Time limit exceeded |
9 | Execution timed out | 2070 ms | 82748 KB | Time limit exceeded |
10 | Execution timed out | 2081 ms | 82908 KB | Time limit exceeded |