제출 #598490

#제출 시각아이디문제언어결과실행 시간메모리
598490MohamedFaresNebiliThe Big Prize (IOI17_prize)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> /// #pragma GCC optimize ("Ofast") /// #pragma GCC target ("avx2") /// #pragma GCC optimize("unroll-loops") using namespace std; using ll = long long; using ld = long double; using ii = pair<ll, ll>; using vi = vector<int>; #define ff first #define ss second #define pb push_back #define all(x) (x).begin(), (x).end() #define lb lower_bound const int MOD = 1e9 + 7; int A[200005][2]; int curr = 0, res = -1; vector<int> query(int k) { if(A[k][0] != -1) return {A[k][0], A[k][1]}; vector<int> V = ask(k); A[k][0] = V[0]; A[k][1] = V[1]; return V; } void solve(int l, int r) { if(res != -1) return; vector<int> V = ask(r); if(V[0] + V[1] == curr && V[0] == calc) return; if(l == r) { calc++; if(V[0] + V[1] == 0) res = l; return; } int md = (l + r) / 2; solve(l, md); solve(md + 1, r); } void init(int N) { queue<pair<int, int>> Q; Q.push({0, N - 1}); while(!Q.empty()) { int l = Q.front().ff, r = Q.front().ss; Q.pop(); if(A[r][0] == -1) { query(r); calc++; } if(calc >= 500) return; curr = max(curr, A[r][0] + A[r][1]); if(l == r) continue; int md = (l + r) / 2; Q.push({l, md}); Q.push({md + 1, r}); } } int find_best(int N) { memset(A, -1, sizeof A); init(N); calc = 0; solve(0, N - 1); return res; }

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

prize.cpp: In function 'std::vector<int> query(int)':
prize.cpp:25:21: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   25 |                     if(A[k][0] != -1)
      |                     ^~
prize.cpp:27:20: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   27 |                    vector<int> V = ask(k);
      |                    ^~~~~~
prize.cpp:27:36: error: 'ask' was not declared in this scope
   27 |                    vector<int> V = ask(k);
      |                                    ^~~
prize.cpp: In function 'void solve(int, int)':
prize.cpp:34:36: error: 'ask' was not declared in this scope
   34 |                    vector<int> V = ask(r);
      |                                    ^~~
prize.cpp:35:54: error: 'calc' was not declared in this scope
   35 |                    if(V[0] + V[1] == curr && V[0] == calc)
      |                                                      ^~~~
prize.cpp:38:23: error: 'calc' was not declared in this scope
   38 |                       calc++;
      |                       ^~~~
prize.cpp: In function 'void init(int)':
prize.cpp:52:33: error: 'calc' was not declared in this scope
   52 |                       query(r); calc++;
      |                                 ^~~~
prize.cpp:54:24: error: 'calc' was not declared in this scope
   54 |                     if(calc >= 500) return;
      |                        ^~~~
prize.cpp: In function 'int find_best(int)':
prize.cpp:64:30: error: 'calc' was not declared in this scope
   64 |                     init(N); calc = 0;
      |                              ^~~~