Submission #87216

# Submission time Handle Problem Language Result Execution time Memory
87216 2018-11-30T02:18:29 Z shoemakerjo Last supper (IOI12_supper) C++14
0 / 100
80 ms 7920 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+K+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;
	}

	// cout << "down here" << endl;
	// for (int i = 0; i < N+K; i++) {
	// 	cout << "thing: " << myuse[i] << endl;
	// }


	set<pii> curstuff;


	for (int i = 0; i < K; i++) {
		curstuff.insert(pii(myuse[i], i));
		curvals[i] = true;
		mp[i] = 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);
			// cout << "1";
		}
		else {
			WriteAdvice(0);
			// cout << "0";
		}
	}
	// cout << endl;

}
#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;
    	nums[i] = i;
    }

    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 Correct 3 ms 752 KB Output is correct
2 Incorrect 4 ms 752 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 1520 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 80 ms 7920 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1044 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 44 ms 6904 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 47 ms 7328 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 47 ms 7520 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 46 ms 7544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 46 ms 7548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 48 ms 7456 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 52 ms 7544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 47 ms 7544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 45 ms 7416 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 42 ms 7564 KB Execution killed with signal 11 (could be triggered by violating memory limits)