답안 #116749

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116749 2019-06-13T17:07:21 Z faustaadp 최후의 만찬 (IOI12_supper) C++17
8 / 100
340 ms 33264 KB
#include "advisor.h"
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll a[101010];
void ComputeAdvice(int *C, int N, int K, int M) 
{
	ll i,j;
	ll x=ceil(log(N)/log(2));
	for(i=0;i<N;i++)
		a[i]=C[i];
	for(i=0;i<N;i++)
	{
		for(j=0;j<x;j++)
			if(a[i]&(1<<j))
			{
			//	cout<<"_1\n";
				WriteAdvice(1);
			}
			else
			{
			//	cout<<"_0\n";
				WriteAdvice(0);
			}
	}
}
#include "assistant.h"
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll z[1010101],isi[101010];
ll y[1010101];
ll ada[1010101];
ll las[1010101];
void Assist(unsigned char *A, int N, int K, int R) 
{
	priority_queue<pair<ll,ll> > pq;
	ll i,j;
	ll x=ceil(log(N)/log(2));
  	for (i = 0; i < R; i++)
  	{
  		if(A[i])
  		{
  	//		cout<<i<<"YA\n";
  			z[i]=1;
  		}
  		//cout<<i<<"___"<<A[i]<<"\n";
  		//z[(ll)A[i]]=1; 
  	}
  	for (i = 0; i < N; i++) 
  		for(j=0;j<x;j++)
  			isi[i]+=z[i*x+j]*(1<<j);
  	for(i=0;i<N;i++)
  	{
  	//	cout<<i<<" "<<isi[i]<<"\n";
  		las[i]=N;
  	}
  	for(i=N-1;i>=0;i--)
  	{
  		y[i]=las[isi[i]];
  		las[isi[i]]=i;
  	}
  	for(i=0;i<K;i++)
  		pq.push(mp(las[i],i));
  	for(i=0;i<K;i++)
  		ada[i]=1;
  	for (i = 0; i < N; i++) 
  	{
	    int req = GetRequest();
  		if(ada[req])
  		{
  			las[isi[i]]=y[i];
	  		pq.push(mp(las[isi[i]],isi[i]));
  		}
  		else
  		{
	  		while(!pq.empty()&&ada[pq.top().se]==0)pq.pop();
	  		while(!pq.empty()&&las[pq.top().se]!=pq.top().fi)pq.pop();
	  		ada[req]=1;
	  		ll tem=pq.top().se;
	  	//	cout<<i<<" "<<tem<<"_)	\n";
	  		pq.pop();
	  		ada[tem]=0;
	  		las[isi[i]]=y[i];
	  		pq.push(mp(las[isi[i]],isi[i]));
	  		//pq.push(mp(las[req],req));
	  		PutBack(tem);
  		}
  	}

}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 920 KB Output is correct
2 Correct 4 ms 872 KB Output is correct
3 Correct 6 ms 1308 KB Output is correct
4 Correct 11 ms 1528 KB Output is correct
5 Correct 16 ms 2188 KB Output is correct
6 Correct 17 ms 2192 KB Output is correct
7 Correct 17 ms 2492 KB Output is correct
8 Correct 17 ms 2108 KB Output is correct
9 Correct 18 ms 2156 KB Output is correct
10 Correct 16 ms 2108 KB Output is correct
11 Correct 17 ms 2236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 3720 KB Output is correct
2 Correct 170 ms 16184 KB Output is correct
3 Runtime error 335 ms 32944 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 284 ms 29664 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 796 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 340 ms 33140 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 328 ms 32828 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 332 ms 33264 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 326 ms 32916 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 325 ms 33132 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 322 ms 32908 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 324 ms 32880 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 326 ms 32884 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 328 ms 32992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 333 ms 33132 KB Execution killed with signal 11 (could be triggered by violating memory limits)