# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
812995 | 2023-08-07T12:34:21 Z | Andrey | Last supper (IOI12_supper) | C++14 | 44 ms | 16608 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(sb[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 | Runtime error | 3 ms | 5076 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 6356 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 28 ms | 14560 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 5588 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 34 ms | 16440 KB | Execution killed with signal 11 |
2 | Runtime error | 34 ms | 16436 KB | Execution killed with signal 11 |
3 | Runtime error | 39 ms | 16564 KB | Execution killed with signal 11 |
4 | Runtime error | 35 ms | 16592 KB | Execution killed with signal 11 |
5 | Runtime error | 38 ms | 16552 KB | Execution killed with signal 11 |
6 | Runtime error | 35 ms | 16596 KB | Execution killed with signal 11 |
7 | Runtime error | 41 ms | 16596 KB | Execution killed with signal 11 |
8 | Runtime error | 33 ms | 16536 KB | Execution killed with signal 11 |
9 | Runtime error | 44 ms | 16576 KB | Execution killed with signal 11 |
10 | Runtime error | 33 ms | 16608 KB | Execution killed with signal 11 |