#include<bits/stdc++.h>
#include "advisor.h"
//#include "grader.h"
using namespace std;
void ComputeAdvice(int *C, int n, int k, int m) {
int ls[100005],nx[100005];
priority_queue<pair<int,int> >q;
vector<pair<int,int> >ret;
for(int i=0;i<n;i++){
ls[i]=1000000000;
nx[i]=0;
}
for(int i=n-1;i>=0;i--){
nx[i]=ls[C[i]];
ls[C[i]]=i;
}
for(int i=0;i<k;i++){
q.push({ls[i],i});
}
for(int i=k;i<=n;i++){
int a=q.top().first;
int j=q.top().second;
q.pop();
ret.push_back({j,1});
q.push({nx[C[i-k]],i});
}
sort(ret.begin(),ret.end());
for(int i=0;i<k+n;i++){
WriteAdvice(ret[i].second);
}
}
#include<bits/stdc++.h>
#include "assistant.h"
//#include "grader.h"
using namespace std;
void Assist(unsigned char *A, int n, int k, int r) {
queue<int>q;
for(int i=0;i<k;i++){
if(A[i]==1) q.push(i);
}
for(int i=0;i<n;i++){
int a=GetRequest();
PutBack(q.front());
q.pop();
if(A[i]==1) q.push(a);
}
}
Compilation message
advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:23:13: warning: unused variable 'a' [-Wunused-variable]
int a=q.top().first;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
780 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
1024 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
27 ms |
4720 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
1024 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
72 ms |
6904 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Incorrect |
68 ms |
6880 KB |
Error - Putting back a color when it is already on the scaffold |
3 |
Incorrect |
67 ms |
6896 KB |
Error - Putting back a color when it is already on the scaffold |
4 |
Incorrect |
73 ms |
6880 KB |
Error - Putting back a color when it is already on the scaffold |
5 |
Incorrect |
69 ms |
6880 KB |
Error - Putting back a color when it is already on the scaffold |
6 |
Incorrect |
69 ms |
6880 KB |
Error - Putting back a color when it is already on the scaffold |
7 |
Incorrect |
71 ms |
6880 KB |
Error - Putting back a color when it is already on the scaffold |
8 |
Incorrect |
71 ms |
6912 KB |
Error - Putting back a color when it is already on the scaffold |
9 |
Incorrect |
67 ms |
6888 KB |
Error - Putting back a color when it is already on the scaffold |
10 |
Incorrect |
64 ms |
6880 KB |
Error - Putting back a color when it is already on the scaffold |