Submission #780872

# Submission time Handle Problem Language Result Execution time Memory
780872 2023-07-12T14:10:13 Z NothingXD Last supper (IOI12_supper) C++17
0 / 100
135 ms 16612 KB
#include<bits/stdc++.h>
#include "advisor.h"

using namespace std;

typedef long long ll;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef complex<ld> point;

void debug_out(){cerr << endl;}

template<typename H, typename... T>
void debug_out(H h, T... t){
	cerr << h << ' ';
	debug_out(t...);
}

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)

const int maxn = 1e5 + 10;

int n, k, m, res[maxn << 1], lst[maxn];
vector<int> idx[maxn];

void ComputeAdvice(int *C, int N, int K, int M) {
	n = N;
	k = K;
	m = M;
	for (int i = 0; i < n; i++){
		idx[C[i]].push_back(i);
	}
	set<pii> st;
	for (int i = 0; i < n; i++){
		idx[i].push_back(n);
		reverse(all(idx[i]));
		st.insert({idx[i].back(), i});
	}
	memset(lst, -1, sizeof lst);
	for (int i = 0; i < k; i++){
		lst[i] = i;
	}
	for (int i = 0; i < n; i++){
		if (lst[C[i]] != -1){
			st.erase({i, C[i]});
			res[lst[C[i]]] = 1;
		}
		else{
			auto it = st.end();
			it--;
			pii tmp = *it;
			st.erase(it);
			lst[tmp.S] = -1;
		}
		idx[C[i]].pop_back();
		st.insert({idx[C[i]].back(), C[i]});
		lst[C[i]] = k+i;
	}
	for (int i = 0; i < k+n; i++){
		WriteAdvice(res[i]);
	}
}
#include<bits/stdc++.h>
#include "assistant.h"

using namespace std;

typedef long long ll;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef complex<ld> point;

/*void debug_out(){cerr << endl;}

template<typename H, typename... T>
void debug_out(H h, T... t){
	cerr << h << ' ';
	debug_out(t...);
}*/

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)

const int maxn = 1e5 + 10;

bool mark[maxn];

void Assist(unsigned char *A, int N, int K, int R) {
	int n = N;
	int k = K;
	vector<int> del;
	for (int i = 0; i < k; i++){
		mark[i] = true;
		if (A[i] == 0) del.push_back(i);
	}
	for (int i = 0; i < n; i++){
		int tmp = GetRequest();
		if (!mark[tmp]){
			PutBack(del.back());
			mark[del.back()] = false;
			del.pop_back();
		}
		mark[tmp] = true;
		if (A[k+i] == 0) del.push_back(tmp);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3344 KB Output is correct
2 Correct 2 ms 3348 KB Output is correct
3 Correct 3 ms 3348 KB Output is correct
4 Incorrect 4 ms 3628 KB Error - Putting back a color that is not on the scaffold
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 4552 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 Correct 88 ms 13336 KB Output is correct
2 Correct 117 ms 15908 KB Output is correct
3 Correct 128 ms 15992 KB Output is correct
4 Correct 115 ms 16008 KB Output is correct
5 Runtime error 115 ms 16612 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3932 KB Output is correct
2 Correct 5 ms 3900 KB Output is correct
3 Incorrect 5 ms 3900 KB Error - Putting back a color that is not on the scaffold
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 114 ms 15652 KB Error - Putting back a color that is not on the scaffold
2 Correct 118 ms 15880 KB Output is correct - 122000 bits used
3 Correct 121 ms 15956 KB Output is correct - 125000 bits used
4 Correct 114 ms 16092 KB Output is correct - 125000 bits used
5 Correct 122 ms 15904 KB Output is correct - 125000 bits used
6 Correct 114 ms 15924 KB Output is correct - 125000 bits used
7 Correct 116 ms 15872 KB Output is correct - 124828 bits used
8 Correct 135 ms 15904 KB Output is correct - 124910 bits used
9 Correct 114 ms 15992 KB Output is correct - 125000 bits used
10 Incorrect 97 ms 15256 KB Error - Putting back a color that is not on the scaffold