답안 #58857

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
58857 2018-07-19T16:31:35 Z thiago4532 최후의 만찬 (IOI12_supper) C++17
0 / 100
491 ms 15288 KB
#include "advisor.h"
#include <bits/stdc++.h>

using namespace std;

string to_binary(int x){
	string str;
	for(int i=12;i>=0;i--)
		str += (bool(x&(1<<i)) + '0');
	return str;
}

void ComputeAdvice(int *C, int N, int K, int M) {
	for(int i=0;i<N;i++){
		string s = to_binary(C[i]);

		for(int i=0;i<13-int(s.size());i++) WriteAdvice(0);

		for(auto& e : s)
			WriteAdvice(e-'0');
	}
}
	
#include "assistant.h"
#include <bits/stdc++.h>

using namespace std;

int to_int(string const& s){
	int ans=0, ct=0;
	for(int i=s.size()-1;i>=0;i--)
		ans += ((s[i]-'0') * (1<<ct)), ++ct;
	return ans;
}

const int inf = 0x3f3f3f3f;
void Assist(unsigned char *A, int N, int K, int R) {
	vector<int> C;
	vector<int> last(N);

	for(int i=0;i<13*N;i+=13){
		string s;
		for(int j=0;j<13;j++)
			s += (A[j+i]+'0');
		C.push_back(to_int(s));
	}

	for(int i=0;i<N;i++)
		last[i] = 0x3f3f3f3f;

	for(int i=0;i<N;i++)
		last[C[i]] = i;

	set<pair<int, int>, greater<pair<int, int>>> conj;

	for(int i=0;i<K;i++)
		conj.insert({last[i], i});

	for(int i=0;i<N;i++){
		int x = GetRequest();
		if(conj.find({last[x], x}) != conj.end())
			continue;

		auto it = conj.begin();
		PutBack(it->second);
		conj.erase(it);

		if(last[x] == i) last[x] = 0x3f3f3f3f;
		conj.insert({last[x], x});
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 640 KB Output is correct
2 Incorrect 4 ms 984 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 2300 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 294 ms 10516 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 12128 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 358 ms 13408 KB Output isn't correct - not an optimal way
2 Incorrect 325 ms 14748 KB Output isn't correct - not an optimal way
3 Incorrect 377 ms 15028 KB Output isn't correct - not an optimal way
4 Incorrect 349 ms 15248 KB Output isn't correct - not an optimal way
5 Incorrect 361 ms 15248 KB Output isn't correct - not an optimal way
6 Incorrect 349 ms 15248 KB Output isn't correct - not an optimal way
7 Incorrect 450 ms 15268 KB Output isn't correct - not an optimal way
8 Incorrect 491 ms 15288 KB Output isn't correct - not an optimal way
9 Incorrect 424 ms 15288 KB Output isn't correct - not an optimal way
10 Incorrect 344 ms 15288 KB Output isn't correct - not an optimal way