Submission #1097025

# Submission time Handle Problem Language Result Execution time Memory
1097025 2024-10-05T19:34:55 Z idiotcomputer Last supper (IOI12_supper) C++11
0 / 100
51 ms 6620 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(x) (int) (x).size()
#define pii pair<int,int>
#define f first
#define s second 

void ComputeAdvice(int *C, int N, int K, int M){
	bool ci[N+K];
	memset(ci,0,sizeof(ci));
	bool vis[N];
	memset(vis,0,sizeof(vis));
	for (int i = N-1; i >= 0; i--){
		if (vis[C[i]]) ci[K+i] = 1;
		vis[C[i]] = 1;
	}
	for (int i = K-1; i >= 0; i--) if (vis[i]) ci[i] = 1;
	
	for (int i = 0; i < N+K; i++) WriteAdvice(ci[i]);
	return;
}

#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(x) (int) (x).size()
#define pii pair<int,int>
#define f first
#define s second


void Assist(unsigned char *A, int N, int K, int R){
	stack<int> o;
	set<pii> all;
	bool vis[N];
	int last[N];
	memset(last,0,sizeof(last));
	memset(vis,0,sizeof(vis));
	for (int i = 0; i < K; i++){
		vis[i] = 1;
		all.insert((pii) {0,i});
		if (A[i] == 0) o.push(i);
	}

	int c,t;
	for (int i = 0; i < N; i++){
		c = GetRequest();
	//	cout << c << ":\n";
		if (vis[c]){
		//	cout << "in\n";
			if (A[i+K] == 0) o.push(c);
			continue;
		}
		//cout << sz(o) << " ";
		if (sz(o)){
			t = o.top();
			o.pop();			
		} else {
			t = (*(all.begin())).s;
		}
		//cout << sz(all) << " " << t << '\n';
	
		vis[t] = 0;
		PutBack(t);
		all.erase((pii) {last[t],t});
		vis[c] = 1;
		last[c] = i+1;
		if (A[i+K] == 0) o.push(c);
		all.insert((pii) {i+1,c});
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 784 KB Output is correct
2 Correct 0 ms 784 KB Output is correct
3 Correct 1 ms 792 KB Output is correct
4 Incorrect 2 ms 824 KB Output isn't correct - not an optimal way
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1316 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 5520 KB Output is correct
2 Correct 47 ms 6564 KB Output is correct
3 Correct 49 ms 6532 KB Output is correct
4 Correct 47 ms 6528 KB Output is correct
5 Incorrect 41 ms 6324 KB Output isn't correct - not an optimal way
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 840 KB Output is correct
2 Correct 3 ms 848 KB Output is correct
3 Incorrect 2 ms 844 KB Output isn't correct - not an optimal way
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 6196 KB Output isn't correct - not an optimal way
2 Correct 49 ms 6516 KB Output is correct - 122000 bits used
3 Correct 46 ms 6592 KB Output is correct - 125000 bits used
4 Correct 51 ms 6460 KB Output is correct - 125000 bits used
5 Correct 51 ms 6472 KB Output is correct - 125000 bits used
6 Correct 48 ms 6572 KB Output is correct - 125000 bits used
7 Correct 48 ms 6460 KB Output is correct - 124828 bits used
8 Correct 47 ms 6544 KB Output is correct - 124910 bits used
9 Correct 45 ms 6512 KB Output is correct - 125000 bits used
10 Incorrect 45 ms 6620 KB Output isn't correct - not an optimal way