제출 #942597

#제출 시각아이디문제언어결과실행 시간메모리
942597yeediotMeetings (JOI19_meetings)C++14
컴파일 에러
0 ms0 KiB
#include "meetings.h" #include<bits/stdc++.h> using namespace std; #define int long long #define F first #define S second #define all(x) x.begin(),x.end() #define pii pair<int,int> #define pb push_back #define sz(x) (int)(x.size()) #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) #define vi vector<int> #define vp vector<pii> #define vvi vector<vi> #define ykh mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()) #define __lg(x) 63-__builtin_clzll(x) #define pow2(x) (1LL<<x) void __print(int x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} #ifdef local void setio(){freopen("/Users/iantsai/Library/Mobile Documents/com~apple~CloudDocs/cpp/Empty.md","r",stdin);} #define debug(x...) cerr << "[" << #x << "] = ["; _print(x) #else void setio(){} #define debug(x...) #endif mt19937 rng(time(0)); int K; bool cmp(int a,int b){ return query(K,a,b)==a; } void qq(int a,int b){ if(a>b)swap(a,b); qq(a,b); } void go(int k,vector<int>temp){ if(sz(temp)==0)return; int n=sz(temp); int k2=rng()%n; K=k; vector<int>child[n],path; for(auto i:temp){ int p=query(k,k2,i); if(p==i){ path.pb(i); } else{ child[p].pb(i); } } sort(all(path),cmp); for(int i=0;i<n;i++){ if(!i){ qq(k,path[i]); } else{ qq(path[i-1],path[i]); } } go(k,child[k]); for(auto i:path){ go(i,child[i]); } } void solve(int N){ int n=N; int k=rng()%n; vector<int>temp; for(int i=0;i<n;i++){ if(i!=k)temp.pb(i); } go(k,temp); } /* input: */

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

meetings.cpp: In function 'bool cmp(long long int, long long int)':
meetings.cpp:45:12: error: 'query' was not declared in this scope; did you mean 'Query'?
   45 |     return query(K,a,b)==a;
      |            ^~~~~
      |            Query
meetings.cpp: In function 'void go(long long int, std::vector<long long int>)':
meetings.cpp:58:15: error: 'query' was not declared in this scope; did you mean 'Query'?
   58 |         int p=query(k,k2,i);
      |               ^~~~~
      |               Query