답안 #577179

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
577179 2022-06-14T08:33:58 Z Justin1 최후의 만찬 (IOI12_supper) C++14
20 / 100
499 ms 83304 KB
#include <bits/stdc++.h>
#include "advisor.h"
using namespace std;

string dectobin(int x, int mx) {
	string res = "";
	for (int i = mx; i >= 0; i--) {
		if ((1 << i) & x) res += '1';
		else res += '0';
	}
	return res;
}

void ComputeAdvice(int *C, int N, int K, int M) {
	int mx = log2(N-1);
	for (int i = 0; i < N; i++) {
		string tmp = dectobin(C[i],mx);
		for (auto j : tmp) WriteAdvice(j-'0');
	}
}
#include <bits/stdc++.h>
#define f first
#define s second
#include "assistant.h"
using namespace std;

int C[100005];
deque<int> pos[100005];

void Assist(unsigned char *A, int N, int K, int R) {
	int lg = log2(N-1)+1;
	for (int i = 0; i < R; i++) {
		C[i/lg] += (1 << (lg - i % lg - 1)) * A[i];
	}
	for (int i = 0; i < N; i++) pos[C[i]].push_back(i);
	for (int i = 0; i < N; i++) pos[i].push_back(1e9);
	set<pair<int,int>> cur;
	for (int i = 0; i < K; i++) cur.insert({pos[i][0],i});
	for (int i = 0; i < N; i++) {
		GetRequest();
		if (cur.find({pos[C[i]][0],C[i]}) != cur.end()) {
			cur.erase({pos[C[i]][0],C[i]});
			pos[C[i]].pop_front();
			cur.insert({pos[C[i]][0],C[i]});
		} else {
			pos[C[i]].pop_front();
			PutBack((*cur.rbegin()).s);
			cur.erase(*cur.rbegin());
			cur.insert({pos[C[i]][0],C[i]});
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 67836 KB Output is correct
2 Correct 39 ms 67972 KB Output is correct
3 Correct 44 ms 68044 KB Output is correct
4 Correct 51 ms 68124 KB Output is correct
5 Correct 54 ms 68360 KB Output is correct
6 Correct 54 ms 68324 KB Output is correct
7 Correct 55 ms 68312 KB Output is correct
8 Correct 54 ms 68536 KB Output is correct
9 Correct 54 ms 68280 KB Output is correct
10 Correct 57 ms 68428 KB Output is correct
11 Correct 60 ms 68400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 69156 KB Output is correct
2 Correct 213 ms 74712 KB Output is correct
3 Correct 439 ms 83304 KB Output is correct
4 Correct 403 ms 81712 KB Output is correct
5 Correct 409 ms 81612 KB Output is correct
6 Correct 407 ms 81880 KB Output is correct
7 Correct 447 ms 82492 KB Output is correct
8 Correct 378 ms 80616 KB Output is correct
9 Correct 375 ms 81328 KB Output is correct
10 Correct 441 ms 82936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 358 ms 79940 KB Output is correct
2 Incorrect 83 ms 70752 KB Error - advice is too long
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 42 ms 68008 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 427 ms 82528 KB Output is partially correct - 1700000 bits used
2 Correct 439 ms 82584 KB Output is partially correct - 1700000 bits used
3 Correct 499 ms 82752 KB Output is partially correct - 1700000 bits used
4 Correct 448 ms 82744 KB Output is partially correct - 1700000 bits used
5 Correct 434 ms 82780 KB Output is partially correct - 1700000 bits used
6 Correct 432 ms 82732 KB Output is partially correct - 1700000 bits used
7 Correct 423 ms 82860 KB Output is partially correct - 1697263 bits used
8 Correct 431 ms 82812 KB Output is partially correct - 1700000 bits used
9 Correct 447 ms 82944 KB Output is partially correct - 1700000 bits used
10 Correct 434 ms 82816 KB Output is partially correct - 1700000 bits used