제출 #386283

#제출 시각아이디문제언어결과실행 시간메모리
386283ismoilov동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).begin(), (x).end()
#define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
#define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
#define fv(c) for(int (a) = (1); (a) <= (c); (a)++)
#define fz(c) for(int (a) = (0); (a) < (c); (a)++)
#define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--)
#define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--)
#define pb push_back
#define in insert
#define ss second
#define ff first

void exploreCave(int n) {
	int v[n], a[n];
	set <int> s;
	fp(i,0,n)
		a[i] = -1, v[i] = 0, s.insert(i);
	int x = 0;
	fp(i,0,n){
		for(auto it : s)
			v[it] = x;
		int y = tryCombination(v, n);
		if(y == i)
			x = (x+1)%2;
		
		int l = 0, r = s.size();
		while(l < r){
			//cout << x << " ";
			int m = (l+r)/2;
			int d = 0;
			for(auto it : s){
				v[it] = (x+1)%2,  d ++;
				if(d == m)
					break;
			}
			int f = tryCombination(v, n);
			if(f > i || f == -1)
				l = m + 1;
			else{
				for(auto it : s){
					v[it] = x,  d ++;
					if(d == m)
						break;
				}
				r = m;
			}
			//cout << l << " " << r << "//\n";
		}
		s.erase(r);
		a[r] = i;
		
		
		/*y = i;
		int g;
		while(y == i)
		{
			fp(j,0,n)
				if(a[j] == -1 || a[j] == n)
					v[j] = (x+1)%2;
			fp(j,0,n){
				if(a[j] == -1){
					v[j] = x, g = j;
					break;
				}
			}
			y = tryCombination(v);
			if(y == i)
				a[g] = n;
		}
		fp(j,0,n)
			if(a[j] == n)
				a[j] = -1;
		a[g] = i;*/
	}
	answer(v, a);
    
}

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:10:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
cave.cpp:24:2: note: in expansion of macro 'fp'
   24 |  fp(i,0,n)
      |  ^~
cave.cpp:10:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
cave.cpp:27:2: note: in expansion of macro 'fp'
   27 |  fp(i,0,n){
      |  ^~
cave.cpp:30:30: error: too many arguments to function 'int tryCombination(int*)'
   30 |   int y = tryCombination(v, n);
      |                              ^
In file included from cave.cpp:1:
cave.h:8:5: note: declared here
    8 | int tryCombination(int S[]);
      |     ^~~~~~~~~~~~~~
cave.cpp:44:31: error: too many arguments to function 'int tryCombination(int*)'
   44 |    int f = tryCombination(v, n);
      |                               ^
In file included from cave.cpp:1:
cave.h:8:5: note: declared here
    8 | int tryCombination(int S[]);
      |     ^~~~~~~~~~~~~~