# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
813007 | 2023-08-07T12:39:42 Z | Andrey | Last supper (IOI12_supper) | C++14 | 2500 ms | 10472 KB |
#include<bits/stdc++.h> #include "advisor.h" using namespace std; vector<int> haha[100001]; void ComputeAdvice(int *c, int n, int k, int m) { int br = 0,z = 1; while(z <= n) { z*=2; br++; } vector<int> ans(0); vector<int> p(n); vector<bool> bruh(n); int a,b; priority_queue<pair<int,int>> idk; for(int i = 0; i < n; i++) { haha[c[i]].push_back(i); } for(int i = 0; i < n; i++) { haha[i].push_back(INT_MAX); } for(int i = 0; i < k; i++) { bruh[i] = true; idk.push({haha[i][0],i}); } for(int i = 0; i < n; i++) { if(bruh[c[i]]) { p[c[i]]++; idk.push({haha[c[i]][p[c[i]]],c[i]}); ans.push_back(INT_MAX); } else { a = idk.top().first; b = idk.top().second; bruh[b] = false; idk.pop(); ans.push_back(b); p[c[i]]++; idk.push({haha[c[i]][p[c[i]]],c[i]}); bruh[c[i]] = true; } } vector<int> sb(n); for(int i = 0; i < n; i++) { if(ans[i] != INT_MAX) { sb[ans[i]]++; } } for(int i = 0; i < n; i++) { for(int j = 0; j < sb[i]; j++) { WriteAdvice(1); } WriteAdvice(0); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2948 KB | Output is correct |
2 | Incorrect | 1 ms | 3084 KB | Output isn't correct - not an optimal way |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 66 ms | 3732 KB | Output isn't correct - not an optimal way |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2510 ms | 9024 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 3240 KB | Output isn't correct - not an optimal way |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2585 ms | 10276 KB | Time limit exceeded |
2 | Execution timed out | 2514 ms | 10140 KB | Time limit exceeded |
3 | Execution timed out | 2601 ms | 10252 KB | Time limit exceeded |
4 | Execution timed out | 2588 ms | 10256 KB | Time limit exceeded |
5 | Execution timed out | 2594 ms | 10268 KB | Time limit exceeded |
6 | Execution timed out | 2503 ms | 10268 KB | Time limit exceeded |
7 | Execution timed out | 2588 ms | 10376 KB | Time limit exceeded |
8 | Execution timed out | 2602 ms | 10240 KB | Time limit exceeded |
9 | Execution timed out | 2584 ms | 10260 KB | Time limit exceeded |
10 | Execution timed out | 2594 ms | 10472 KB | Time limit exceeded |