# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
271179 |
2020-08-18T05:00:31 Z |
반딧불(#5113) |
Last supper (IOI12_supper) |
C++14 |
|
86 ms |
18424 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;
chk[tmp.second] = 0;
pq.push({times[arr[i]].back(), arr[i]});
chk[arr[i]] = 1;
}
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 |
2 ms |
5376 KB |
Output is correct |
2 |
Incorrect |
4 ms |
5376 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 |
7664 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
46 ms |
15848 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
5632 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
86 ms |
18160 KB |
Error - advice is too long |
2 |
Incorrect |
76 ms |
18416 KB |
Error - advice is too long |
3 |
Incorrect |
61 ms |
18416 KB |
Error - advice is too long |
4 |
Incorrect |
60 ms |
18408 KB |
Error - advice is too long |
5 |
Incorrect |
60 ms |
18424 KB |
Error - advice is too long |
6 |
Incorrect |
75 ms |
18416 KB |
Error - advice is too long |
7 |
Incorrect |
57 ms |
18280 KB |
Error - advice is too long |
8 |
Incorrect |
66 ms |
18416 KB |
Error - advice is too long |
9 |
Incorrect |
64 ms |
18280 KB |
Error - advice is too long |
10 |
Incorrect |
66 ms |
18416 KB |
Error - advice is too long |