Submission #382843

# Submission time Handle Problem Language Result Execution time Memory
382843 2021-03-28T09:58:37 Z alishahali1382 Last supper (IOI12_supper) C++14
0 / 100
2500 ms 4912 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<K; 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<K; i++) A[i]=AA[i], B[i]=1;
	for (int i=K; i<N+K; 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 1020 KB Output is correct
2 Correct 2 ms 868 KB Output is correct
3 Correct 2 ms 876 KB Output is correct
4 Incorrect 16 ms 932 KB Output isn't correct - not an optimal way
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 1196 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2389 ms 3988 KB Output is correct
2 Execution timed out 2554 ms 4784 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 772 KB Output is correct
2 Correct 13 ms 976 KB Output is correct
3 Incorrect 28 ms 1156 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 2508 ms 4660 KB Time limit exceeded
2 Execution timed out 2580 ms 4664 KB Time limit exceeded
3 Execution timed out 2580 ms 4784 KB Time limit exceeded
4 Execution timed out 2600 ms 4824 KB Time limit exceeded
5 Execution timed out 2598 ms 4668 KB Time limit exceeded
6 Execution timed out 2590 ms 4912 KB Time limit exceeded
7 Execution timed out 2583 ms 4620 KB Time limit exceeded
8 Execution timed out 2590 ms 4668 KB Time limit exceeded
9 Execution timed out 2585 ms 4784 KB Time limit exceeded
10 Execution timed out 2507 ms 4668 KB Time limit exceeded