# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
121394 |
2019-06-26T13:16:55 Z |
MAMBA |
Last supper (IOI12_supper) |
C++17 |
|
165 ms |
138536 KB |
#include <bits/stdc++.h>
#include "advisor.h"
using namespace std;
#define rep(i, j, k) for (int i = j; i < (int)k; i++)
#define pb push_back
void ComputeAdvice(int S[], int n, int k, int ignore) {
deque<int> c[n];
vector<bool> mark(n);
vector<bool> res(n + k);
priority_queue<pair<int, int>> pq;
rep(i, 0, k) {
c[i].push_back(i);
mark[i] = true;
}
rep(i, 0, n) c[S[i]].push_back(i + k);
rep(i, 0, k) {
int v = c[i].front();
c[i].pop_front();
int u = n + k;
if (!c[i].empty()) u = c[i].front();
pq.push({u, v});
}
rep(i, 0, n) {
c[S[i]].pop_front();
if (!mark[S[i]]) {
int id = pq.top().second;
pq.pop();
res[id] = true;
if (id >= k) id = S[id - k];
mark[id] = false;
int u = n + k;
if (!c[S[i]].empty()) u = c[S[i]].front();
pq.push({u, i + k});
mark[S[i]] = true;
}
}
rep(i, 0, k + n) WriteAdvice(res[i]);
}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std;
#define rep(i, j, k) for (int i = j; i < (int)k; i++)
#define pb push_back
void Assist(unsigned char A[], int n, int k, int ignore) {
vector<bool> mark(n);
vector<int> q;
int l = 0;
rep(i, 0, k) {
mark[i] = true;
if (A[i]) q.pb(i);
}
rep(i, 0, n) {
int g = GetRequest();
if (A[i + k]) q.pb(g);
if (!mark[g]) {
PutBack(q[l]);
mark[q[l++]] = false;
mark[g] = true;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
648 KB |
Output is correct |
2 |
Incorrect |
4 ms |
768 KB |
Error - Putting back a color that is not on the scaffold |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
14336 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
128 ms |
111296 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
6144 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
165 ms |
138280 KB |
Output isn't correct - not an optimal way |
2 |
Incorrect |
162 ms |
138536 KB |
Output isn't correct - not an optimal way |
3 |
Incorrect |
162 ms |
138424 KB |
Output isn't correct - not an optimal way |
4 |
Incorrect |
160 ms |
138328 KB |
Output isn't correct - not an optimal way |
5 |
Incorrect |
157 ms |
138336 KB |
Output isn't correct - not an optimal way |
6 |
Incorrect |
160 ms |
138344 KB |
Output isn't correct - not an optimal way |
7 |
Incorrect |
164 ms |
138192 KB |
Output isn't correct - not an optimal way |
8 |
Incorrect |
163 ms |
138336 KB |
Output isn't correct - not an optimal way |
9 |
Incorrect |
160 ms |
138288 KB |
Output isn't correct - not an optimal way |
10 |
Correct |
160 ms |
138328 KB |
Output is correct - 125000 bits used |