제출 #205165

#제출 시각아이디문제언어결과실행 시간메모리
205165theStaticMind도서관 (JOI18_library)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define pb push_back #define ii pair<int,int> #define all(x) (x).begin(),(x).end() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; #include<library.h> vector<int> Q(n, 0); int ind = 0; vector<int> adj[1001]; int bin(int l, int r){ int ret = -1; while(l <= r){ int mid = (l + r) / 2; vector<int> arr(n, 0); for(int i = 0; i <= mid; i++)arr[i] = 1; arr[r + 1] = 1; if(Query(arr) == Q[mid]){ ret = mid; r = mid - 1; } else{ l = mid + 1; } } return ret; } void Solve(int n){ vector<int> arr(n, 0); for(;ind < n; ind++){ arr[ind] = 1; int Q[ind] = Query(arr); if(ind != 0 && Q[ind] == Q[ind - 1]){ int x = bin(0, ind - 1); adj[x].pb(ind); adj[ind].pb(x); x = bin(x + 1, ind - 1); if(x != -1){ adj[x].pb(ind); adj[ind].pb(x); } } } int root = 0; while(sz(adj[root]) == 2)root++; vector<int> ans; int x = root; for(int i = 0; i < n; i++){ if(adj[x].size() == 1){ ans.pb(x); x = adj[x][0]; } else{ if(ans.back() == adj[x][0]){ ans.pb(x); x = adj[x][1]; } else{ ans.pb(x); x = adj[x][0]; } } } Answer(ans); }

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

library.cpp:13:15: error: 'n' was not declared in this scope
 vector<int> Q(n, 0);
               ^
library.cpp: In function 'long long int bin(long long int, long long int)':
library.cpp:23:29: error: 'n' was not declared in this scope
             vector<int> arr(n, 0);
                             ^
library.cpp: In function 'void Solve(long long int)':
library.cpp:44:31: error: array must be initialized with a brace-enclosed initializer
             int Q[ind] = Query(arr);
                          ~~~~~^~~~~
library.cpp:58:13: error: 'sz' was not declared in this scope
       while(sz(adj[root]) == 2)root++;
             ^~