Submission #58867

# Submission time Handle Problem Language Result Execution time Memory
58867 2018-07-19T16:43:00 Z thiago4532 Last supper (IOI12_supper) C++17
0 / 100
518 ms 18216 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=N-1;i>=0;i--)
		last[C[i]] = i;

	cout << "C: ";
	for(int i=0;i<N;i++)
		cout << C[i] << " \n"[i==N-1];

	cout << "LAST: ";
	for(int i=0;i<N;i++)
		cout << last[i] << " \n"[i==N-1];

	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);
		
		conj.insert({last[x], x});
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 640 KB Hacked
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 2032 KB Hacked
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 357 ms 12012 KB Hacked
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 14680 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 423 ms 16172 KB Hacked
2 Incorrect 410 ms 17664 KB Hacked
3 Incorrect 436 ms 17888 KB Hacked
4 Incorrect 462 ms 18112 KB Hacked
5 Incorrect 488 ms 18160 KB Hacked
6 Incorrect 518 ms 18208 KB Hacked
7 Incorrect 408 ms 18208 KB Hacked
8 Incorrect 455 ms 18212 KB Hacked
9 Incorrect 463 ms 18216 KB Hacked
10 Incorrect 418 ms 18216 KB Hacked