제출 #474237

#제출 시각아이디문제언어결과실행 시간메모리
474237MB2동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include"cave.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll S[5009],D[5009];
bool fix[5009];
void swp(ll x, ll y)
{
	for(ll i=x; i<=y; i++)
	{
		if(!fix[i])
		S[i]^=1;
	}
}
ll search(ll cur, ll n)
{
	ll r=n-1,l=0;
	if(tryCombination(S)!=cur)
	swp(0,n-1);
	while(r!=l)
	{
		ll mid=(l+r)/2;
		swp(l,mid);
		ll inf=tryCombination(S);
		swp(l,mid);
		if(inf==cur)
		l=mid+1;
		else
		r=mid;
	}
	return r;
}
void exploreCave(ll x)
{
	for(ll i=0; i<x; i++)
	{
		ll cur=search(i,x);
		fix[cur]=true;
		S[cur]^=1;
		D[cur]=1;
	}
	answer(S,D);
}

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

cave.cpp: In function 'long long int search(long long int, long long int)':
cave.cpp:18:20: error: cannot convert 'long long int*' to 'int*'
   18 |  if(tryCombination(S)!=cur)
      |                    ^
      |                    |
      |                    long long int*
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:24:25: error: cannot convert 'long long int*' to 'int*'
   24 |   ll inf=tryCombination(S);
      |                         ^
      |                         |
      |                         long long int*
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp: In function 'void exploreCave(long long int)':
cave.cpp:42:9: error: cannot convert 'long long int*' to 'int*'
   42 |  answer(S,D);
      |         ^
      |         |
      |         long long int*
In file included from cave.cpp:1:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~