Submission #382847

# Submission time Handle Problem Language Result Execution time Memory
382847 2021-03-28T10:09:59 Z alishahali1382 Last supper (IOI12_supper) C++14
0 / 100
2500 ms 6120 KB
#include "advisor.h"
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=1000000000000001000LL;
const int mod=1000000007;
const int MAXN=300010, LOG=20;

int nex[MAXN], last[MAXN];

void ComputeAdvice(int *C, int N, int K, int M){
	for (int i=0; i<N; i++) last[i]=N;
	for (int i=N-1; ~i; i--){
		nex[i]=last[C[i]];
		last[C[i]]=i;
	}
	for (int i=0; i<N; i++) WriteAdvice(last[i]<N);
	for (int i=0; i<N; i++) WriteAdvice(nex[i]<N);
}
#include "assistant.h"
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=1000000000000001000LL;
const int mod=1000000007;
const int MAXN=300010, LOG=20;

bool A[MAXN], B[MAXN];

void Assist(unsigned char *AA, int N, int K, int R){
	for (int i=0; i<N; i++) A[i]=AA[i], B[i]=(i<K);
	for (int i=N; i<N+N; i++){
		int col=GetRequest();
		A[col]=AA[i];
		if (!B[col]){
			bool ok=0;
			for (int j=0; j<N && !ok; j++) if (B[j] && !A[j]){
				PutBack(j);
				B[j]=0;
				ok=1;
			}
			for (int j=0; j<N && !ok; j++) if (B[j]){
				PutBack(j);
				B[j]=0;
				ok=1;
			}
			assert(ok);
			B[col]=1;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 872 KB Output is correct
2 Correct 2 ms 744 KB Output is correct
3 Correct 3 ms 952 KB Output is correct
4 Incorrect 13 ms 784 KB Output isn't correct - not an optimal way
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 1464 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2397 ms 4612 KB Output is correct
2 Execution timed out 2586 ms 6120 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1168 KB Output is correct
2 Correct 13 ms 1156 KB Output is correct
3 Incorrect 28 ms 1064 KB Output isn't correct - not an optimal way
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2590 ms 5316 KB Time limit exceeded
2 Execution timed out 2583 ms 5196 KB Time limit exceeded
3 Execution timed out 2594 ms 5196 KB Time limit exceeded
4 Execution timed out 2571 ms 5196 KB Time limit exceeded
5 Execution timed out 2588 ms 5580 KB Time limit exceeded
6 Execution timed out 2579 ms 5196 KB Time limit exceeded
7 Execution timed out 2511 ms 5340 KB Time limit exceeded
8 Execution timed out 2510 ms 5196 KB Time limit exceeded
9 Execution timed out 2523 ms 5196 KB Time limit exceeded
10 Execution timed out 2582 ms 5200 KB Time limit exceeded