제출 #144821

#제출 시각아이디문제언어결과실행 시간메모리
144821youssefbou62동굴 (IOI13_cave)C++14
0 / 100
94 ms512 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; #define mp make_pair #define fi first #define se second #define all(v) v.begin(),v.end() #define allarr(a) a , a + n #define ll long long #define ull unsigned long long #define pb push_back #define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL) typedef pair<int, int> pi; typedef pair<ll,ll> pll; typedef pair<int,pi> trp ; typedef vector<pi> vpi; typedef vector<pll> vpll ; // int ab (int x ) { return (x>0?x:-x); } int n ; int TryCombination(int S[]){ cerr << "try this Combination ! "<<endl; for(int i =0 ; i < n;i++ ){ cout << S[i]; }cout << endl; int ans ; cin >> ans; return ans; } void exploreCave(int N){ n = N ; int door[N],Combination[N]={0},Mode[N]; memset(door,-1,sizeof door); int reply =0; cerr << "*****exploreCave("<<N<<")*******"<<endl; while(reply!=-1){ int l = 0 , r= N-1 ; int last = tryCombination(Combination); while ( l<= r ){ int mid = (l+r)/2 ; if( l == r ){ cerr << "yaaay door of "<<r<<" is "<<reply<<endl; door[r]=reply; break ; } for(int i = l ; i <= mid ; i++ ){ if( door[i] == -1 ){ Combination[i]= (!Combination[i]); } } reply = tryCombination(Combination); if( reply == -1 )break ; if( reply == last){ l = mid+1; }else { for(int i = l ; i <= mid ; i++ ){ if( door[i] == -1 ){ Combination[i]= (!Combination[i]); } } r = mid; } } } cerr <<"***answer**"<<endl; assert(reply==-1); for(int i = 0 ; i < n ; i++ ){ Combination[i]=!Combination[i]; reply = tryCombination(Combination); if(reply != -1 ) Combination[i]=!Combination[i]; } for(int i = 0 ; i < n ; i++ )cout <<Combination[i]; cout << endl; for(int i = 0 ; i < n ; i++ )cout <<door[i]; cout << endl; } // int main(){ // cin >> n ; // exploreCave(n); // }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:76:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for(int i = 0 ; i < n ; i++ )cout <<Combination[i]; cout << endl; 
  ^~~
cave.cpp:76:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for(int i = 0 ; i < n ; i++ )cout <<Combination[i]; cout << endl; 
                                                      ^~~~
cave.cpp:77:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for(int i = 0 ; i < n ; i++ )cout <<door[i]; cout << endl; 
  ^~~
cave.cpp:77:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for(int i = 0 ; i < n ; i++ )cout <<door[i]; cout << endl; 
                                               ^~~~
cave.cpp:35:33: warning: unused variable 'Mode' [-Wunused-variable]
  int door[N],Combination[N]={0},Mode[N]; 
                                 ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...