# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
271161 |
2020-08-18T04:57:19 Z |
반딧불(#5113) |
Last supper (IOI12_supper) |
C++14 |
|
108 ms |
19448 KB |
#include <bits/stdc++.h>
#include "advisor.h"
using namespace std;
namespace{
int n, k, m, b;
int arr[100002];
int ans[100002];
bool chk[100002];
priority_queue<pair<int, int> > pq;
vector<int> times[100002];
}
void ComputeAdvice(int *ARR, int N, int K, int M){
n = N, k = K, m = M;
if(n<=5000) b=13; else b=20;
for(int i=0; i<n; i++){
arr[i] = ARR[i];
times[arr[i]].push_back(i);
}
for(int i=0; i<n; i++) times[i].push_back(1e9);
for(int i=0; i<n; i++){
reverse(times[i].begin(), times[i].end());
if(i<k) pq.push({times[i].back(), i});
}
for(int i=0; i<k; i++) chk[i] = 1;
for(int i=0; i<n; i++){
times[arr[i]].pop_back();
if(chk[arr[i]]){
ans[i] = n;
continue;
}
pair<int, int> tmp = pq.top(); pq.pop();
while(times[tmp.second].back() != tmp.first){
pq.push({times[tmp.second].back(), tmp.second});
tmp = pq.top(); pq.pop();
}
ans[i] = tmp.second;
pq.push({times[arr[i]].back(), arr[i]});
}
for(int i=0; i<n; i++){
for(int j=0; j<b; j++){
WriteAdvice(!!(ans[i] & (1<<j)));
}
}
}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std;
namespace{
int n, k, l, b;
int arr[2000002];
}
void Assist(unsigned char *ARR, int N, int K, int R) {
n = N, k = K, l = R;
if(n<=5000) b=13; else b=20;
for(int i=0; i<R; i++) arr[i] = ARR[i];
for(int i=0; i<n; i++){
GetRequest();
int tmp = 0;
for(int j=0; j<b; j++){
tmp += (1<<j) * arr[i*b+j];
}
if(tmp != n) PutBack(tmp);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
5376 KB |
Output is correct |
2 |
Incorrect |
3 ms |
5376 KB |
Error - Putting back a color when it is already on the scaffold |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
54 ms |
7680 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
16872 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
5888 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
65 ms |
19184 KB |
Error - advice is too long |
2 |
Incorrect |
65 ms |
19440 KB |
Error - advice is too long |
3 |
Incorrect |
59 ms |
19440 KB |
Error - advice is too long |
4 |
Incorrect |
65 ms |
19384 KB |
Error - advice is too long |
5 |
Incorrect |
78 ms |
19344 KB |
Error - advice is too long |
6 |
Incorrect |
108 ms |
19440 KB |
Error - advice is too long |
7 |
Incorrect |
72 ms |
19440 KB |
Error - advice is too long |
8 |
Incorrect |
68 ms |
19440 KB |
Error - advice is too long |
9 |
Incorrect |
59 ms |
19272 KB |
Error - advice is too long |
10 |
Incorrect |
60 ms |
19448 KB |
Error - advice is too long |