Submission #58865

# Submission time Handle Problem Language Result Execution time Memory
58865 2018-07-19T16:41:41 Z thiago4532 Last supper (IOI12_supper) C++17
0 / 100
524 ms 18392 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 4 ms 616 KB Hacked
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 2256 KB Hacked
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 331 ms 11824 KB Hacked
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 14544 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 390 ms 16188 KB Hacked
2 Incorrect 524 ms 17928 KB Hacked
3 Incorrect 487 ms 18024 KB Hacked
4 Incorrect 498 ms 18024 KB Hacked
5 Incorrect 454 ms 18104 KB Hacked
6 Incorrect 432 ms 18184 KB Hacked
7 Incorrect 458 ms 18184 KB Hacked
8 Incorrect 496 ms 18288 KB Hacked
9 Incorrect 434 ms 18392 KB Hacked
10 Incorrect 385 ms 18392 KB Hacked