답안 #132921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
132921 2019-07-20T00:22:43 Z arthurconmy 최후의 만찬 (IOI12_supper) C++14
0 / 100
270 ms 12376 KB
#include <bits/stdc++.h>
#include "advisor.h"

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] != 0) WriteAdvice(1);
			else WriteAdvice(0);
		}
	}
}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std;

const int INF = 10000000;

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;
	}

	for(int i=0; i<k; i++) scaff.push({next_col_occ[i],i});

	int ans=0;

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

		if(on_scaff[C[i]]) continue;

		else
		{			
			ans++;

			PutBack(C[scaff.top().second]);
			on_scaff[C[scaff.top().second]]=0;
			scaff.pop();
		
			on_scaff[C[i]]=1;
			scaff.push({next_occ[i],C[i]});
		}
	}
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:12:19: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
    if(1<<b & C[i] != 0) WriteAdvice(1);
              ~~~~~^~~~

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:47:7: warning: unused variable 'do_nothing' [-Wunused-variable]
   int do_nothing = GetRequest();
       ^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 760 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 1704 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 219 ms 9996 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 880 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 267 ms 12200 KB Error - Not putting back color when it is not on the scaffold
2 Incorrect 270 ms 12260 KB Error - Not putting back color when it is not on the scaffold
3 Incorrect 267 ms 12260 KB Error - Not putting back color when it is not on the scaffold
4 Incorrect 267 ms 12128 KB Error - Not putting back color when it is not on the scaffold
5 Incorrect 268 ms 12360 KB Error - Not putting back color when it is not on the scaffold
6 Incorrect 270 ms 12232 KB Error - Not putting back color when it is not on the scaffold
7 Incorrect 268 ms 12264 KB Error - Not putting back color when it is not on the scaffold
8 Incorrect 270 ms 12156 KB Error - Not putting back color when it is not on the scaffold
9 Incorrect 266 ms 12376 KB Error - Not putting back color when it is not on the scaffold
10 Incorrect 267 ms 12364 KB Error - Not putting back color when it is not on the scaffold