제출 #590463

#제출 시각아이디문제언어결과실행 시간메모리
590463tamthegodXylophone (JOI18_xylophone)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define int long long #define pb push_back #define fi first #define se second using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int maxN = 1e6 + 5; const int mod = 1e9 + 7; const ll oo = 1e18; int res[maxN]; void solve(int n) { int low = 1, high = n, mid; while(low <= high) { mid = (low + high) / 2; if(query(mid, n) == n - 1) low = mid + 1; else high = mid -1; } low--; res[low] = 1; //cout << query(1, 2);exit(0); if(low > 1) { res[low - 1] = 1 + query(low - 1, low); } if(low < n) res[low + 1] = 1 + query(low, low + 1); for(int i=low-2; i>=1; i--) { int val1 = query(i, i + 1); int val2 = query(i, i + 2); if(res[i + 1] > res[i + 2]) { if(res[i + 1] - res[i + 2] == val2) { res[i] = res[i + 1] - val1; } else { int val = res[i + 2] + val2; if(val - res[i + 1] == val1) res[i] = val; else res[i] = res[i + 1] - val2; } } else { if(res[i + 2] - res[i + 1] == val2) { res[i] = res[i + 1] + val1; } else { int val = res[i + 2] - val2; if(res[i + 1] - val == val1) res[i] = val; else res[i] = res[i + 1] + val2; } } } for(int i=low+2; i<=n; i++) { int val1 = query(i - 1, i); int val2 = query(i - 2, i); if(res[i - 1] > res[i - 2]) { if(res[i - 1] - res[i - 2] == val2) { res[i] = res[i - 1] - val1; } else { int val = res[i - 2] + val2; if(val - res[i - 1] == val1) res[i] = val; else res[i] = res[i - 1] - val2; } } else { if(res[i - 2] - res[i - 1] == val2) { res[i] = res[i - 1] + val1; } else { int val = res[i - 2] - val2; if(res[i - 1] - val == val1) res[i] = val; else res[i] = res[i - 1] + val2; } } } for(int i=1; i<=n; i++) answer(i, res[i]); }

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

xylophone.cpp: In function 'void solve(long long int)':
xylophone.cpp:22:12: error: 'query' was not declared in this scope
   22 |         if(query(mid, n) == n - 1) low = mid + 1;
      |            ^~~~~
xylophone.cpp:30:28: error: 'query' was not declared in this scope
   30 |         res[low - 1] = 1 + query(low - 1, low);
      |                            ^~~~~
xylophone.cpp:32:36: error: 'query' was not declared in this scope
   32 |     if(low < n) res[low + 1] = 1 + query(low, low + 1);
      |                                    ^~~~~
xylophone.cpp:35:20: error: 'query' was not declared in this scope
   35 |         int val1 = query(i, i + 1);
      |                    ^~~~~
xylophone.cpp:66:20: error: 'query' was not declared in this scope
   66 |         int val1 = query(i - 1, i);
      |                    ^~~~~
xylophone.cpp:95:29: error: 'answer' was not declared in this scope
   95 |     for(int i=1; i<=n; i++) answer(i, res[i]);
      |                             ^~~~~~