Submission #58868

# Submission time Handle Problem Language Result Execution time Memory
58868 2018-07-19T16:45:18 Z thiago4532 Last supper (IOI12_supper) C++17
0 / 100
441 ms 15264 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;

	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 7 ms 608 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 2200 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 308 ms 10532 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 12320 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 419 ms 13460 KB Output isn't correct - not an optimal way
2 Incorrect 374 ms 14660 KB Output isn't correct - not an optimal way
3 Incorrect 393 ms 14888 KB Output isn't correct - not an optimal way
4 Incorrect 435 ms 15136 KB Output isn't correct - not an optimal way
5 Incorrect 417 ms 15216 KB Output isn't correct - not an optimal way
6 Incorrect 377 ms 15216 KB Output isn't correct - not an optimal way
7 Incorrect 380 ms 15216 KB Output isn't correct - not an optimal way
8 Incorrect 378 ms 15216 KB Output isn't correct - not an optimal way
9 Incorrect 419 ms 15240 KB Output isn't correct - not an optimal way
10 Incorrect 441 ms 15264 KB Output isn't correct - not an optimal way