Submission #1312350

#TimeUsernameProblemLanguageResultExecution timeMemory
1312350eri16스핑크스 (IOI24_sphinx)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "sphinx.h" using namespace std; /* int perform_experiment(vector <int> v){ for (auto x : v){cout<<x<<" ";}cout<<"\n"; int z; cin>>z; return z; } */ vector<int> find_colours(int N, vector<int> X, vector<int> Y){ int n = N; vector <int> ans(n,0); for (int i=0; i<n; i++){ int l = 0; int r = n-1; while (l<r){ int mid = (l+r)/2; //cout<<l<<' '<<r<<"\n"; vector <int> tm (n,n); int cnt = l; for (int j=0; j<n; j++){ if (i==j){tm[j]=-1;} else{ if (cnt<=mid){ tm[j]=cnt; } cnt++; } } //cout<<l<<' '<<mid<<' '<<r<<"\n"; int found = perform_experiment(tm); if (l==0 && mid+2==n){ if (found != mid - l + 1){l = mid + 1;//cout<<"ranfunction#11"<<"\n";} else{r = mid;//cout<<"ranfunction#22"<<"\n";} } else{ if (found != mid - l + 2){l = mid + 1;//cout<<"ranfunction#1"<<"\n";} else{r = mid;//cout<<"ranfunction#2"<<"\n";} } } ans[i]=l; //cout<<"answer to id "<<i<<" was color "<<l<<"\n"; } return ans; }

Compilation message (stderr)

sphinx.cpp: In function 'std::vector<int> find_colours(int, std::vector<int>, std::vector<int>)':
sphinx.cpp:47:17: error: expected '}' before 'else'
   47 |                 else{r = mid;//cout<<"ranfunction#22"<<"\n";}
      |                 ^~~~
sphinx.cpp:46:42: note: to match this '{'
   46 |                 if (found != mid - l + 1){l = mid + 1;//cout<<"ranfunction#11"<<"\n";}
      |                                          ^
sphinx.cpp:49:13: error: expected '}' before 'else'
   49 |             else{
      |             ^~~~
sphinx.cpp:45:34: note: to match this '{'
   45 |             if (l==0 && mid+2==n){
      |                                  ^
sphinx.cpp:51:17: error: expected '}' before 'else'
   51 |                 else{r = mid;//cout<<"ranfunction#2"<<"\n";}
      |                 ^~~~
sphinx.cpp:50:42: note: to match this '{'
   50 |                 if (found != mid - l + 2){l = mid + 1;//cout<<"ranfunction#1"<<"\n";}
      |                                          ^
sphinx.cpp:58:2: error: expected '}' at end of input
   58 | }
      |  ^
sphinx.cpp:13:62: note: to match this '{'
   13 | vector<int> find_colours(int N, vector<int> X, vector<int> Y){
      |                                                              ^
sphinx.cpp:58:2: warning: control reaches end of non-void function [-Wreturn-type]
   58 | }
      |  ^