답안 #116756

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116756 2019-06-13T17:24:28 Z faustaadp 최후의 만찬 (IOI12_supper) C++17
20 / 100
383 ms 32676 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];
ll lok[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));
  		ada[i]=1;
  		lok[i]=i;
  	}
  	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;
	  		ll za=lok[tem];
	  		lok[za]=req;
	  	//	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 996 KB Output is correct
2 Correct 4 ms 776 KB Output is correct
3 Correct 6 ms 1052 KB Output is correct
4 Correct 12 ms 1700 KB Output is correct
5 Correct 17 ms 2068 KB Output is correct
6 Correct 18 ms 2076 KB Output is correct
7 Correct 18 ms 2204 KB Output is correct
8 Correct 18 ms 2076 KB Output is correct
9 Correct 17 ms 2068 KB Output is correct
10 Correct 18 ms 2204 KB Output is correct
11 Correct 17 ms 2076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 3408 KB Output is correct
2 Correct 165 ms 15776 KB Output is correct
3 Correct 349 ms 32568 KB Output is correct
4 Correct 339 ms 30340 KB Output is correct
5 Correct 352 ms 31204 KB Output is correct
6 Correct 350 ms 31964 KB Output is correct
7 Correct 344 ms 32356 KB Output is correct
8 Correct 295 ms 27240 KB Output is correct
9 Correct 360 ms 30540 KB Output is correct
10 Correct 349 ms 32592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 274 ms 25524 KB Output is correct
2 Incorrect 28 ms 5888 KB Error - advice is too long
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 768 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 358 ms 32460 KB Output is partially correct - 1700000 bits used
2 Partially correct 356 ms 32676 KB Output is partially correct - 1700000 bits used
3 Partially correct 357 ms 32544 KB Output is partially correct - 1700000 bits used
4 Partially correct 361 ms 32416 KB Output is partially correct - 1700000 bits used
5 Partially correct 383 ms 32524 KB Output is partially correct - 1700000 bits used
6 Partially correct 361 ms 32580 KB Output is partially correct - 1700000 bits used
7 Partially correct 351 ms 32452 KB Output is partially correct - 1697263 bits used
8 Partially correct 363 ms 32464 KB Output is partially correct - 1700000 bits used
9 Partially correct 357 ms 32448 KB Output is partially correct - 1700000 bits used
10 Partially correct 355 ms 31404 KB Output is partially correct - 1700000 bits used