답안 #87222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
87222 2018-11-30T03:07:13 Z shoemakerjo 최후의 만찬 (IOI12_supper) C++14
0 / 100
77 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(true);
			// cout << "1";
		}
		else {
			WriteAdvice(false);
			// 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);
    	}
    }

    // cout << "A: ";
    // for (int i = 0; i < N+K; i++) {
    // 	if (A[i] == 0) cout << 0;
    // 	else cout << 1;
    // }
    // cout << endl;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 764 KB Output is correct
2 Incorrect 4 ms 768 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 1520 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 77 ms 7920 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1036 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 45 ms 6904 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 49 ms 7160 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 47 ms 7672 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 50 ms 7544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 49 ms 7544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 49 ms 7672 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 49 ms 7544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 45 ms 7544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 45 ms 7544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 64 ms 7544 KB Execution killed with signal 11 (could be triggered by violating memory limits)