Submission #87202

# Submission time Handle Problem Language Result Execution time Memory
87202 2018-11-30T02:07:20 Z shoemakerjo Last supper (IOI12_supper) C++14
0 / 100
48 ms 13676 KB
#include "advisor.h"
#include <bits/stdc++.h>

using namespace std;
#define pii pair<int, int>
#define maxn 100010

int curind[2*maxn];

int myuse[2*maxn];
bool isremoved[maxn];

bool curvals[maxn];
int mp[maxn];
int nums[maxn];

void ComputeAdvice(int *C, int N, int K, int M) {

	for (int i = 0; i < K; i++) {
		nums[i] = i;
	}
	for (int i = K; i < K+N; i++) {
		nums[i] = C[i-K];
	}


	for (int i = 0; i < N; i++) {
		curind[i] = N+1;
	}

	for (int i = N-1; i >= 0; i--) {
		int val = C[i];

		myuse[i + K] = curind[val];
		curind[val] = i+K;
	}

	for (int i = K-1; i >= 0; i--) {
		myuse[i] = curind[i];
		curind[i] = i;
	}

	set<pii> curstuff;


	for (int i = 0; i < K; i++) {
		curstuff.insert(pii(myuse[i], i));
		curvals[i] = true;
		mp[i] = myuse[i];
	}
	for (int i = K; i < N+K; i++) {
		int val = C[i-K];

		if (curvals[val]) {
			curstuff.erase(curstuff.find(pii(myuse[mp[val]], mp[val])));
			mp[val] = i;

			curstuff.insert(pii(myuse[i], i));
		}
		else {
			pii cur = *(curstuff.rbegin());

			curvals[nums[cur.second]] = false;
			isremoved[cur.second] = true;

			curstuff.erase(curstuff.find(cur));

			mp[val] = i;
			curstuff.insert(pii(myuse[i], i));
		}
	}

	for (int i = 0; i < K+N; i++) {
		if (isremoved[i]) WriteAdvice(1);
		else WriteAdvice(0);
	}

}
#include "assistant.h"
#include <bits/stdc++.h>

using namespace std;
#define maxn 100010
#define nums fakenums
#define curvals asdklasfdgashdgflkas

set<int> toremo;
int nums[maxn];

bool curvals[maxn];

void Assist(unsigned char *A, int N, int K, int R) {

    for (int i = 0; i < K; i++) {
    	if (A[i] == 1) toremo.insert(i);
    	curvals[i] = true;
    }

    for (int i = 0; i < N; i++) {
    	int val = GetRequest();
    	nums[i+K] = val;

    	if (!curvals[val]) {
    		curvals[val] = true;

    		int tmp = *(toremo.begin());

    		curvals[nums[tmp]] = false;
    		toremo.erase(tmp);
    		PutBack(nums[tmp]);

    	}
    	if (A[i+K] == 1) {
    		toremo.insert(i+K);
    	}
    }

}
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 1480 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 24 ms 6232 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 6232 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 7496 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 40 ms 8216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 31 ms 8940 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 31 ms 9648 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 36 ms 10424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 33 ms 10960 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 31 ms 11580 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 32 ms 11996 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 35 ms 12876 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 48 ms 13676 KB Execution killed with signal 11 (could be triggered by violating memory limits)