Submission #18743

# Submission time Handle Problem Language Result Execution time Memory
18743 2016-02-15T03:55:25 Z suhgyuho_william Last supper (IOI12_supper) C++
Compilation error
0 ms 0 KB
#include <stdio.h>
#include "advisor.h"

void ComputeAdvice(int *C, int N, int K, int M) {
	int i,j;
	int t,cnt;

	t = cnt = 1;
	while(true){
		if(t >= N-1) break;
		cnt++;
		t *= 2;
	}
	for(i=0; i<N; i++){
		t = C[i];
		for(j=1; j<=cnt; j++){
			WriteAdvice(t%2);
			t /= 2;
		}
	}
}
#include "assistant.h"
#include <stdio.h>
#include <queue>
#include <vector>
#include <stdlib.h>

using namespace std;

int a[100010];
bool check[100010];
#define pp pair<int,int>
priority_queue<pp> q;
int next[100010];
vector<int> paint[100010];

void Assist(unsigned char *A, int N, int K, int R) {
	int i,j;
	int t,cnt;
	pp top;

	t = cnt = 1;
	while(true){
		if(t >= N-1) break;
		cnt++;
		t *= 2;
	}
	for(i=0; i<N*cnt; i+=cnt){
		t = 1;
		for(j=0; j<cnt; j++){
			a[(i/cnt)+1] += (t*A[i+j]);
			t *= 2;
		}
	}
	for(i=1; i<=N; i++){
        if(check[a[i]] == false && a[i] < K){
			check[a[i]] = true;
			q.push(make_pair(i,a[i]));
        }
        paint[a[i]].push_back(i);
	}
	for(i=0; i<K; i++){
		if(check[i]) continue;
		check[i] = true;
		q.push(make_pair(0,i));
	}
	for(i=0; i<N; i++){
		cnt = paint[i].size();
		for(j=0; j<cnt-1; j++){
			next[paint[i][j]] = paint[i][j+1];
		}
		if(cnt != 0){
			next[paint[i][cnt-1]] = 0;
		}
	}
	for(i=1; i<=N; i++){
		t = GetRequest();
		if(check[t]) continue;
		top = q.top();
		q.pop();
		PutBack(top.second);
		check[top.second] = false;
		check[t] = true;
		q.push(make_pair(next[i],t));
	}
}

Compilation message

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:49:4: error: reference to 'next' is ambiguous
    next[paint[i][j]] = paint[i][j+1];
    ^~~~
assistant.cpp:13:5: note: candidates are: int next [100010]
 int next[100010];
     ^~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:66:0,
                 from /usr/include/c++/7/deque:60,
                 from /usr/include/c++/7/queue:60,
                 from assistant.cpp:3:
/usr/include/c++/7/bits/stl_iterator_base_funcs.h:208:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^~~~
assistant.cpp:52:4: error: reference to 'next' is ambiguous
    next[paint[i][cnt-1]] = 0;
    ^~~~
assistant.cpp:13:5: note: candidates are: int next [100010]
 int next[100010];
     ^~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:66:0,
                 from /usr/include/c++/7/deque:60,
                 from /usr/include/c++/7/queue:60,
                 from assistant.cpp:3:
/usr/include/c++/7/bits/stl_iterator_base_funcs.h:208:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^~~~
assistant.cpp:63:20: error: reference to 'next' is ambiguous
   q.push(make_pair(next[i],t));
                    ^~~~
assistant.cpp:13:5: note: candidates are: int next [100010]
 int next[100010];
     ^~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:66:0,
                 from /usr/include/c++/7/deque:60,
                 from /usr/include/c++/7/queue:60,
                 from assistant.cpp:3:
/usr/include/c++/7/bits/stl_iterator_base_funcs.h:208:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^~~~