Submission #132893

# Submission time Handle Problem Language Result Execution time Memory
132893 2019-07-19T22:52:20 Z arthurconmy Last supper (IOI12_supper) C++14
0 / 100
19 ms 2800 KB
#include <bits/stdc++.h>

#ifndef ARTHUR_LOCAL
	#include "advisor.h"
#endif

using namespace std;

void ComputeAdvice(int *C, int n, int k, int m)
{
	for(int i=0; i<n; i++)
	{
		for(int b=0; b<13; b++)
		{
			if(1<<b & C[i]) WriteAdvice('1');
			else WriteAdvice('0');
		}
	}
}

// int main()
// {
// 	#ifdef ARTHUR_LOCAL
// 		ifstream cin("input.txt");
// 	#endif


// }
#include <bits/stdc++.h>

#ifndef ARTHUR_LOCAL
	#include "assistant.h"
#endif

using namespace std;

const int INF = 1000000000;

void Assist(unsigned char *A, int n, int k, int r)
{
	vector<int> C;

	for(int i=0; i<n; i++)
	{
		int cur=0;

		for(int b=0; b<13; b++)
		{
			if(A[i*13 + b]=='1') cur += 1<<b;
		}

		C.push_back(cur);
	}

	// now we actually have to use the optimal strat ...

	vector<bool> on_scaff(n+1);

	for(int i=0; i<k; i++) on_scaff[i]=1;

	priority_queue<pair<int,int>> scaff;

	vector<int> next_col_occ(n+1,INF);
	vector<int> next_occ(n+1,INF);

	for(int i=n-1; i>=0; i--)
	{
		if(i<k) scaff.push({next_col_occ[C[i]],C[i]});
		next_occ[i]=next_col_occ[C[i]];
		next_col_occ[C[i]]=i;
	}

	int ans=0;

	for(int i=0; i<n; i++)
	{
		if(on_scaff[C[i]]) continue;

		else
		{			
			ans++;

			PutBack(scaff.top().second);
			on_scaff[scaff.top().second]=0;
			scaff.pop();
		
			on_scaff[C[i]]=1;
			scaff.push({next_occ[i],C[i]});
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 764 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 820 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 2288 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 972 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 2544 KB Error - advice must be 0 or 1
2 Incorrect 18 ms 2544 KB Error - advice must be 0 or 1
3 Incorrect 18 ms 2544 KB Error - advice must be 0 or 1
4 Incorrect 18 ms 2488 KB Error - advice must be 0 or 1
5 Incorrect 19 ms 2552 KB Error - advice must be 0 or 1
6 Incorrect 18 ms 2544 KB Error - advice must be 0 or 1
7 Incorrect 18 ms 2544 KB Error - advice must be 0 or 1
8 Incorrect 18 ms 2544 KB Error - advice must be 0 or 1
9 Incorrect 18 ms 2544 KB Error - advice must be 0 or 1
10 Incorrect 18 ms 2800 KB Error - advice must be 0 or 1