Submission #87215

# Submission time Handle Problem Language Result Execution time Memory
87215 2018-11-30T02:17:56 Z shoemakerjo Last supper (IOI12_supper) C++14
0 / 100
75 ms 8624 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 4 ms 888 KB Output is correct
2 Incorrect 4 ms 772 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 2032 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 8624 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 1076 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 7672 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 45 ms 7804 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 45 ms 8004 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 45 ms 8060 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 45 ms 8060 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 44 ms 8144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 44 ms 8056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 47 ms 8108 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 48 ms 8148 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 41 ms 8112 KB Execution killed with signal 11 (could be triggered by violating memory limits)