제출 #1313182

#제출 시각아이디문제언어결과실행 시간메모리
1313182sitingfake동굴 (IOI13_cave)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> //#include "cave.h" using namespace std; // define //bool M1; //#define execute cerr << " Time: " << fixed << setprecision(6) << (1.0 * clock() / CLOCKS_PER_SEC) << "s\n"; //#define memory cerr << abs(&M2 - &M1)/1024.0/1024 << " MB" << "\n" #define ll long long #define ii pair <int , int> #define iii pair <int , ii> #define se second #define fi first #define all(v) (v).begin() , (v).end() #define Unique(v) sort(all(v)) , v.resize(unique(all(v)) - v.begin()) #define bit(x,i) (((x) >> (i)) & 1LL) #define flip(x,i) ((x) ^ (1LL << (i))) #define ms(d,x) memset(d , x , sizeof(d)) #define exist __exist #define ends __ends #define visit visited #define left __left #define right __right #define prev __prev #define next __next #define sitingfake 1 #define orz 1 //constant const long long mod = 1e9 + 7; const long long linf = 4557430888798830399LL; const long long nlinf = -4485090715960753727LL; const int inf = 1061109567; const int ninf = -1044266559; const int dx[] = {0 , -1 , 0 , 1}; const int dy[] = {-1 , 0 , 1 , 0}; template<typename T> bool maximize(T &a, const T &b) { if(a < b) {a = b; return 1;} return 0; } template<typename T> bool minimize(T &a, const T &b) { if(a > b) {a = b; return 1;} return 0; } void Plus(ll & a ,ll b) { b %= mod; a += b; if(a < 0) a += mod; a %= mod; return; } void Mul(ll & a, ll b) { (a *= (b % mod)) %= mod; return; } //code const int maxn = 5e3 + 7; void findState(int state[] , int n) { vector <int> p; for(int i = 0; i < n; i++) { state[i] = 1; p.push_back(i); } int cur = tryCombination(state); if(cur == -1) return; while(!p.empty()) { int left = 0 , right = p.size() - 1 , pos = -1 , val = inf; int ask[n]; for(int i = 0; i < n; i++) { ask[i] = state[i]; } while(left <= right) { int mid = (right + left) >> 1; for(int i = 0; i <= mid; i++) { ask[p[i]] = !state[p[i]]; } int d = tryCombination(ask); if(d == -1) { for(int i = 0; i <= mid; i++) { state[p[i]] ^= 1; } return; } if(d != cur) { right = mid - 1; pos = mid; val = d; } else { left = mid + 1; } } if(pos == -1) return; if(val < cur) { for(int i = 0; i < pos; i++) { state[p[i]] ^= 1; } } else { for(int i = 0; i <= pos; i++) { state[p[i]] ^= 1; } cur = val; } for(int i = 0; i < pos; i++) p.push_back(p[i]); p.erase(p.begin() , p.begin() + pos); } } void exploreCave(int n) { int state[n] , res[n]; findState(state , n); for(int i = 0; i < n; i++) { state[i] ^= 1; res[i] = tryCombination(state); state[i] ^= 1; } answer(state , res); } /** **/

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

cave.cpp: In function 'void findState(int*, int)':
cave.cpp:79:15: error: 'tryCombination' was not declared in this scope
   79 |     int cur = tryCombination(state);
      |               ^~~~~~~~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:149:18: error: 'tryCombination' was not declared in this scope
  149 |         res[i] = tryCombination(state);
      |                  ^~~~~~~~~~~~~~
cave.cpp:152:5: error: 'answer' was not declared in this scope
  152 |     answer(state , res);
      |     ^~~~~~