Submission #829687

# Submission time Handle Problem Language Result Execution time Memory
829687 2023-08-18T14:06:50 Z AdamGS Last supper (IOI12_supper) C++17
0 / 100
55 ms 6220 KB
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e5+7;
int kiedy[LIM], nxt[LIM], on[LIM], uzyte[2*LIM];
void ComputeAdvice(int *c, int n, int k, int m) {
	rep(i, n) kiedy[i]=n;
	for(int i=n-1; i>=0; --i) {
		nxt[i]=kiedy[c[i]];
		kiedy[c[i]]=i;
	}
	priority_queue<pair<int,pair<int,int>>>q;
	rep(i, k) {
		on[i]=1;
		q.push({kiedy[i], {i, i}});
	}
	rep(i, n) {
		if(!on[c[i]]) {
			int a=q.top().nd.st, b=q.top().nd.nd; q.pop();
			uzyte[b]=1;
			on[a]=0;
		}
		on[c[i]]=1;
		q.push({nxt[i], {c[i], i+k}});
	}
	rep(i, n) WriteAdvice(uzyte[i]);
}
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e5+7;
int xd[LIM];
void Assist(unsigned char *A, int n, int k, int r) {
	queue<int>q;
	rep(i, k) {
		xd[i]=1;
		if(A[i]) q.push(i);
	}
	rep(i, n) {
		int a=GetRequest();
		if(!xd[a]) {
			int p=q.front(); q.pop();
			PutBack(p);
			xd[a]=1;
			xd[p]=0;
		}	
		if(i+k>=n || A[k+i]) q.push(a);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 516 KB Output is correct
2 Incorrect 0 ms 512 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 5 ms 1236 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 38 ms 4740 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 2 ms 920 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 48 ms 6028 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 45 ms 5952 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 49 ms 6008 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 47 ms 6036 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 46 ms 5948 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 48 ms 5980 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 46 ms 6060 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 50 ms 6000 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 55 ms 6220 KB Error - Putting back a color that is not on the scaffold
10 Correct 44 ms 5456 KB Output is correct - 100000 bits used