Submission #1217862

#TimeUsernameProblemLanguageResultExecution timeMemory
1217862lukasuliashviliCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include"cave.h".
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define pb push_back
#define fs first 
#define sc second 
#define rep(i,a,b) for(int i=a; i<b; i++)
void exploreCave(int N){
	int N1=2*1e6+5;
	int fix[N],ans[N],s[N];
	rep(i,0,N){fix[i]=-1;ans[i]=-1;}
	// ans[j] --> j chamrtvelistvis romeli karia
	// fix[i] i karistvis 1 ia tu -1 
	for(int i=0; i<N; i++){
		rep(j,0,N){
			if(ans[j]!=-1){
				s[j]=fix[ans[j]]<<" ";
			}
			else{
				s[j]=0;
			}
		}
		
		int last=tryCombination(s);
		if( last<=i and last!=-1){
			fix[i]=1;
		}
		else{
			fix[i]=0;
		}
		int l=0;
		int r=N-1;
		while(l<=r){
			if(l==r){
				ans[l]=i;
				break;
			}
			int mid=(l+r)/2;
			rep(j,0,l){
				if(ans[j]!=-1){
					s[j]=fix[ans[j]];
				}
				else{
					s[j]=(fix[i]^1);
				}
			}
			rep(j,l,mid+1){
				if(ans[j]!=-1){
					s[j]=fix[ans[j]];
				}
				else{
					s[j]=fix[i];
				}
			}
			rep(j,mid+1,N){
				if(ans[j]!=-1){
					s[j]=fix[ans[j]];
				}
				else{
					s[j]=(fix[i]^1);
				}
			}
			tryCombination()
			cin>>last;
			if(last<=i and last!=-1){
				l=mid+1;
			}
			else{
				r=mid;
			}
		}
	}
	
	rep(i,0,N){
		ans2[i]=fix[ans[i]];
	}
	answer(ans2,ans);
	// ans2 ans 
}

Compilation message (stderr)

cave.cpp:1:17: warning: extra tokens at end of #include directive
    1 | #include"cave.h".
      |                 ^
cave.cpp: In function 'void exploreCave(long long int)':
cave.cpp:18:49: error: invalid operands of types 'long long int' and 'const char [2]' to binary 'operator<<'
   18 |                                 s[j]=fix[ans[j]]<<" ";
      |                                      ~~~~~~~~~~~^~~~~
      |                                                |  |
      |                                                |  const char [2]
      |                                                long long int
cave.cpp:25:41: error: cannot convert 'long long int*' to 'int*'
   25 |                 int last=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:64:39: error: too few arguments to function 'int tryCombination(int*)'
   64 |                         tryCombination()
      |                         ~~~~~~~~~~~~~~^~
In file included from cave.cpp:1:
cave.h:8:5: note: declared here
    8 | int tryCombination(int S[]);
      |     ^~~~~~~~~~~~~~
cave.cpp:76:17: error: 'ans2' was not declared in this scope; did you mean 'ans'?
   76 |                 ans2[i]=fix[ans[i]];
      |                 ^~~~
      |                 ans
cave.cpp:78:16: error: 'ans2' was not declared in this scope; did you mean 'ans'?
   78 |         answer(ans2,ans);
      |                ^~~~
      |                ans