Submission #67348

# Submission time Handle Problem Language Result Execution time Memory
67348 2018-08-14T03:55:43 Z WA_TLE Last supper (IOI12_supper) C++14
Compilation error
0 ms 0 KB
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#define pub push_back
#define pob pop_back
#define mp make_pair
#define sec second
using namespace std;
//#include"grader.cpp"
const int mod=1e9+7;
void WriteAdvice(unsigned char a) {};
void ComputeAdvice(int *C, int N, int K, int M) {
	static bool kta[200000]={};
	int i,j;
	priority_queue<pair<int,int>>que;
	//次いる日、入れたときの番号
	vector<vector<int>>need(N);
	for(i=0;i<N;i++){need[i].pub(mod);}
	for(i=N-1;i>=0;i--){need[C[i]].pub(i);}
	static bool tna[100000]={};
	for(i=0;i<K;i++){que.push(mp(need[i].back(),i));tna[i]=1;}
	for(i=0;i<N;i++){
		int use=C[i];
		need[use].pob();
		if(!tna[use]){
			pair<int,int> ksu;
			while(-1){
				ksu=que.top();que.pop();
				int ter;
				if(ksu.sec<K){ter=ksu.sec;}else{ter=C[ksu.sec-K];}
				if(tna[ter]){kta[ksu.sec]=1;tna[ter]=0;break;}
			}
			tna[use]=1;
		}
		que.push(mp(need[use].back(),i+K));
	}
	for(i=0;i<K+N;i++){WriteAdvice(kta[i]);}
}
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#define pub push_back
#define pob pop_back
#define mp make_pair
#define sec second

void Assist(unsigned char *A, int N, int K, int R) {
	int i;
	deque<int>iran;
	static bool aru[100000]={};
	for(i=0;i<K;i++){if(A[i]){iran.pub(i);}aru[i]=1;}
	for(i=0;i<N;i++) {
		int req=GetRequest();
		if(!aru[req]){PutBack(iran.back());iran.pob();}
		if(A[i+K]){iran.pub(req);}
	}
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:15:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j;
        ^
/tmp/cc93d1j3.o: In function `WriteAdvice(unsigned char)':
advisor.cpp:(.text+0x0): multiple definition of `WriteAdvice(unsigned char)'
/tmp/ccHp2V81.o:advisor_grader.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:12:2: error: 'deque' was not declared in this scope
  deque<int>iran;
  ^~~~~
assistant.cpp:12:2: note: suggested alternative:
In file included from /usr/include/c++/7/deque:64:0,
                 from /usr/include/c++/7/queue:60,
                 from assistant.cpp:3:
/usr/include/c++/7/bits/stl_deque.h:831:11: note:   'std::deque'
     class deque : protected _Deque_base<_Tp, _Alloc>
           ^~~~~
assistant.cpp:12:8: error: expected primary-expression before 'int'
  deque<int>iran;
        ^~~
assistant.cpp:14:28: error: 'iran' was not declared in this scope
  for(i=0;i<K;i++){if(A[i]){iran.pub(i);}aru[i]=1;}
                            ^~~~
assistant.cpp:14:28: note: suggested alternative: 'srand'
  for(i=0;i<K;i++){if(A[i]){iran.pub(i);}aru[i]=1;}
                            ^~~~
                            srand
assistant.cpp:16:11: error: 'GetRequest' was not declared in this scope
   int req=GetRequest();
           ^~~~~~~~~~
assistant.cpp:17:25: error: 'iran' was not declared in this scope
   if(!aru[req]){PutBack(iran.back());iran.pob();}
                         ^~~~
assistant.cpp:17:25: note: suggested alternative: 'srand'
   if(!aru[req]){PutBack(iran.back());iran.pob();}
                         ^~~~
                         srand
assistant.cpp:17:17: error: 'PutBack' was not declared in this scope
   if(!aru[req]){PutBack(iran.back());iran.pob();}
                 ^~~~~~~
assistant.cpp:18:14: error: 'iran' was not declared in this scope
   if(A[i+K]){iran.pub(req);}
              ^~~~
assistant.cpp:18:14: note: suggested alternative: 'srand'
   if(A[i+K]){iran.pub(req);}
              ^~~~
              srand