Submission #578697

# Submission time Handle Problem Language Result Execution time Memory
578697 2022-06-17T16:14:26 Z WongChun1234 Last supper (IOI12_supper) C++14
0 / 100
137 ms 73752 KB
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
int c[100050],curr[100050],lpos[100050],opt[200050];
deque<int> ap[100050];
priority_queue<pair<int,int>> pq;
void ComputeAdvice(int *C, int n, int k, int m) {
	for (int i=0;i<n;i++) c[i]=C[i];
	for (int i=0;i<n;i++) ap[c[i]].push_back(i);
	for (int i=0;i<n;i++) ap[i].push_back(2e9);
	for (int i=0;i<k;i++) curr[i]=lpos[i]=i,pq.push({ap[i][0],i});
	for (int i=k;i<n;i++) curr[i]=lpos[i]=-1;
	for (int i=0;i<n;i++){
		int choice;
		lpos[c[i]]=k+i;
		if (curr[c[i]]!=-1){
			choice=32767;
		}else{
			choice=curr[c[i]]=curr[pq.top().second];
			opt[lpos[pq.top().second]]=1;
			curr[pq.top().second]=-1;
			pq.pop();
		}
		while (ap[c[i]].front()<=i) ap[c[i]].pop_front();
		pq.push({ap[c[i]].front(),c[i]});
	}
	for (int i=0;i<n+k;i++) WriteAdvice(opt[i]);
}
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;
int pos[100050];
priority_queue<int> dump;
void Assist(unsigned char *A, int n, int k, int R) {
	for (int i=0;i<k;i++) pos[i]=i;
	for (int i=k;i<n;i++) pos[i]=-1;
	for (int i=0;i<k;i++) if (A[i]) dump.push(i);
	for (int i=0;i<n;i++){
		int nxt=GetRequest();
		int choice=0;
		if (pos[nxt]!=-1){
		}else{
			PutBack(dump.top());
			pos[dump.top()]=-1;
			dump.pop();
			pos[nxt]=1;
			if (A[i+k]) dump.push(nxt);
		}
	}
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:15:7: warning: variable 'choice' set but not used [-Wunused-but-set-variable]
   15 |   int choice;
      |       ^~~~~~

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:13:7: warning: unused variable 'choice' [-Wunused-variable]
   13 |   int choice=0;
      |       ^~~~~~
# Verdict Execution time Memory Grader output
1 Correct 42 ms 68088 KB Output is correct
2 Incorrect 43 ms 68188 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 51 ms 68472 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 72444 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 68184 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 135 ms 73548 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 128 ms 73556 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 132 ms 73628 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 126 ms 73620 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 128 ms 73752 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 129 ms 73592 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 128 ms 73568 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 128 ms 73496 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 134 ms 73628 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 137 ms 73384 KB Error - Putting back a color that is not on the scaffold