제출 #144900

#제출 시각아이디문제언어결과실행 시간메모리
144900youssefbou62동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 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 cnt = 0 ; int TryCombination(int S[]){ cnt++; return tryCombination(S); } void exploreCave(int N){ n = N ; int door[N],Combination[N]={0},Mode[N]; memset(door,-1,sizeof door); int reply =0; for(int X = 0 ; X < n ; X++){ int l = 0 , r= N-1 ; int last = TryCombination(Combination); reply = last; if( last == -1 )break ; while ( l < r && reply != -1 ){ int mid = l + (r-l)/2; if( l == r ){ 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 { r = mid; } } assert(l==r||reply==-1); if( l == r ) door[l]=reply ; if (reply == -1 )break ; } assert(reply==-1); for(int i = 0 ; i < n ; i++ ){ if( door[i]==-1){ Combination[i]=!Combination[i]; reply = TryCombination(Combination); door[i]=reply; Combination[i]=!Combination[i]; } } answer(Combination,door); } #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 cnt = 0 ; int TryCombination(int S[]){ cnt++; return tryCombination(S); } void exploreCave(int N){ n = N ; int door[N],Combination[N]={0},Mode[N]; memset(door,-1,sizeof door); int reply =0; for(int X = 0 ; X < n ; X++){ int l = 0 , r= N-1 ; int last = TryCombination(Combination); reply = last; if( last == -1 )break ; while ( l < r && reply != -1 ){ int mid = l + (r-l)/2; if( l == r ){ 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 { r = mid; } } assert(l==r||reply==-1); if( l == r ) door[l]=reply ; if (reply == -1 )break ; } assert(reply==-1); for(int i = 0 ; i < n ; i++ ){ if( door[i]==-1){ Combination[i]=!Combination[i]; reply = TryCombination(Combination); door[i]=reply; Combination[i]=!Combination[i]; } } answer(Combination,door); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:33:37: warning: unused variable 'Mode' [-Wunused-variable]
      int door[N],Combination[N]={0},Mode[N]; 
                                     ^~~~
cave.cpp: At global scope:
cave.cpp:101:9: error: redefinition of 'int n'
     int n ; 
         ^
cave.cpp:22:9: note: 'int n' previously declared here
     int n ; 
         ^
cave.cpp:102:9: error: redefinition of 'int cnt'
     int cnt = 0 ; 
         ^~~
cave.cpp:23:9: note: 'int cnt' previously defined here
     int cnt = 0 ; 
         ^~~
cave.cpp: In function 'int TryCombination(int*)':
cave.cpp:104:9: error: redefinition of 'int TryCombination(int*)'
     int TryCombination(int S[]){
         ^~~~~~~~~~~~~~
cave.cpp:25:9: note: 'int TryCombination(int*)' previously defined here
     int TryCombination(int S[]){
         ^~~~~~~~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:110:10: error: redefinition of 'void exploreCave(int)'
     void exploreCave(int N){
          ^~~~~~~~~~~
cave.cpp:31:10: note: 'void exploreCave(int)' previously defined here
     void exploreCave(int N){
          ^~~~~~~~~~~
cave.cpp:112:37: warning: unused variable 'Mode' [-Wunused-variable]
      int door[N],Combination[N]={0},Mode[N]; 
                                     ^~~~