Submission #1177492

#TimeUsernameProblemLanguageResultExecution timeMemory
1177492kadir동굴 (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include "cave.h"
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;
const ll mod=1e9+7;
const ll inf=1e18;
const ll mxn=2e5+5;
void exploreCave(int N){
   	ll a[N+5],b[N+5],c[N+5];
	for(ll i=0;i<N;i++){
    	ll s[N+5];
    	for(ll j=0;j<N;j++){
    		if(c[j]!=0) s[j]=a[j];
			else s[j]=0;
		}
		ll x=tryCombination(s);
		ll t=1;
		if(x==-1 || x>i) t=0;
		vector<ll> v;
		for(ll j=0;j<n;j++){
			if(c[j]==0) v.pb(j);
		}
		while(v.size()>1){
			for(ll j=0;j<n;j++){
				if(c[j]!=0) s[j]=a[j];
				else s[j]=0;
			}
	
			vector<ll> v1,v2;
			ll u=v.size();
			for(ll j=0;j<u/2;j++){
				v1.pb(v[j]);
				s[v[j]]=(1-t);
			}
			for(ll j=u/2;j<u;j++){
				v2.pb(v[j]);
				s[v[j]]=(1-t);
			}
			x=tryCombination(s);
			if(x==-1 || x>i) v=v1;
			else v=v2;
		}
		c[v.back()]=1;
		a[v.back()]=t;
		b[v.back()]=i;
	}
	ll s[N+5],k[N+5];
	for(ll i=0;i<N;i++){
		s[i]=a[i];
		k[i]=b[i];
	}
	answer(s,k);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:19:37: error: cannot convert 'long long int*' to 'int*'
   19 |                 ll x=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:23:30: error: 'n' was not declared in this scope
   23 |                 for(ll j=0;j<n;j++){
      |                              ^
cave.cpp:27:38: error: 'n' was not declared in this scope
   27 |                         for(ll j=0;j<n;j++){
      |                                      ^
cave.cpp:42:42: error: cannot convert 'long long int*' to 'int*'
   42 |                         x=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:55:16: error: cannot convert 'long long int*' to 'int*'
   55 |         answer(s,k);
      |                ^
      |                |
      |                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[]);
      |             ~~~~^~~