# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1005948 |
2024-06-23T08:51:11 Z |
정민찬(#10832) |
Last supper (IOI12_supper) |
C++14 |
|
39 ms |
70468 KB |
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
const int B = 20;
void ComputeAdvice(int *C, int N, int K, int M) {
vector<queue<int>> q(N);
for (int i=0; i<N; i++) {
q[C[i]].push(i);
}
priority_queue<pair<int,int>> pq;
for (int i=0; i<K; i++) {
if (q[i].empty()) pq.push({N, i});
else pq.push({q[i].front(), i});
}
vector<int> use(N, 0);
for (int i=0; i<K; i++) use[i] = 1;
for (int i=0; i<N; i++) {
int x = -1;
if (!use[C[i]]) {
while (true) {
int tp = pq.top().second;
int cst = pq.top().first;
pq.pop();
if (!q[tp].empty() && q[tp].front() != cst) continue;
if (q[tp].empty() && cst != N) continue;
if (!use[tp]) continue;
x = tp;
break;
}
use[x] = 0;
use[C[i]] = 1;
}
q[C[i]].pop();
if (q[C[i]].empty()) pq.push({N, C[i]});
else pq.push({q[C[i]].front(), C[i]});
x ++;
for (int bit=0; bit<B; bit++) {
WriteAdvice((1<<bit) & x);
}
}
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
const int B = 20;
void Assist(unsigned char *A, int N, int K, int R) {
for (int i=0; i<N; i++) {
int x = 0;
for (int bit=0; bit<B; bit++) {
x ^= A[i*B+bit] << bit;
}
GetRequest();
x --;
if (x != -1) {
PutBack(x);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
876 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
7768 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
56840 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
3500 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
70272 KB |
Error - advice must be 0 or 1 |
2 |
Incorrect |
39 ms |
70248 KB |
Error - advice must be 0 or 1 |
3 |
Incorrect |
35 ms |
70468 KB |
Error - advice must be 0 or 1 |
4 |
Incorrect |
34 ms |
70468 KB |
Error - advice must be 0 or 1 |
5 |
Incorrect |
35 ms |
70316 KB |
Error - advice must be 0 or 1 |
6 |
Incorrect |
34 ms |
70464 KB |
Error - advice must be 0 or 1 |
7 |
Incorrect |
34 ms |
70316 KB |
Error - advice must be 0 or 1 |
8 |
Incorrect |
34 ms |
70268 KB |
Error - advice must be 0 or 1 |
9 |
Incorrect |
39 ms |
70268 KB |
Error - advice must be 0 or 1 |
10 |
Incorrect |
34 ms |
70284 KB |
Error - advice must be 0 or 1 |