답안 #116752

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116752 2019-06-13T17:09:00 Z faustaadp 최후의 만찬 (IOI12_supper) C++17
20 / 100
380 ms 33584 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[2010101],isi[101010];
ll y[101010];
ll ada[101010];
ll las[101010];
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 644 KB Output is correct
2 Correct 4 ms 768 KB Output is correct
3 Correct 6 ms 916 KB Output is correct
4 Correct 12 ms 1488 KB Output is correct
5 Correct 18 ms 1948 KB Output is correct
6 Correct 17 ms 2068 KB Output is correct
7 Correct 18 ms 2316 KB Output is correct
8 Correct 18 ms 2120 KB Output is correct
9 Correct 16 ms 1940 KB Output is correct
10 Correct 18 ms 2320 KB Output is correct
11 Correct 17 ms 2184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 3408 KB Output is correct
2 Correct 164 ms 15420 KB Output is correct
3 Correct 341 ms 32040 KB Output is correct
4 Correct 351 ms 31296 KB Output is correct
5 Correct 345 ms 31852 KB Output is correct
6 Correct 351 ms 32304 KB Output is correct
7 Correct 355 ms 33352 KB Output is correct
8 Correct 295 ms 27932 KB Output is correct
9 Correct 351 ms 31036 KB Output is correct
10 Correct 354 ms 33584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 279 ms 25452 KB Output is correct
2 Incorrect 31 ms 7152 KB Error - advice is too long
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 776 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 368 ms 32280 KB Output is partially correct - 1700000 bits used
2 Partially correct 350 ms 32304 KB Output is partially correct - 1700000 bits used
3 Partially correct 338 ms 32168 KB Output is partially correct - 1700000 bits used
4 Partially correct 336 ms 32352 KB Output is partially correct - 1700000 bits used
5 Partially correct 339 ms 32292 KB Output is partially correct - 1700000 bits used
6 Partially correct 341 ms 32348 KB Output is partially correct - 1700000 bits used
7 Partially correct 348 ms 32100 KB Output is partially correct - 1697263 bits used
8 Partially correct 346 ms 32296 KB Output is partially correct - 1700000 bits used
9 Partially correct 380 ms 32040 KB Output is partially correct - 1700000 bits used
10 Partially correct 358 ms 31280 KB Output is partially correct - 1700000 bits used