제출 #442664

#제출 시각아이디문제언어결과실행 시간메모리
442664Theo830콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; typedef long long ll; ll INF = 1e18+7; long long MOD = 998244353; typedef pair<ll,ll> ii; #define iii pair<ii,ll> #define f(i,a,b) for(long long i = a;i < b;i++) #define rf(i,a,b) for(long long i=a;i>=b;i--) #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define w(t) while(t--) #define c(n); cin>>n; #define p(n) cout<<n; #define pl(n) cout<<n<<endl; #define ps(n); cout<<n<<" "; #define F first #define S second #define pb(a) push_back(a) #define all(x) (x).begin(), (x).end() #define ull unsigned long long #define vll vector<ll> #define vii vector<ii> #define mkp make_pair #define ld long double #define arrin(a,n) f(i,0,n){cin>>a[i];} #define arrout(a,n) f(i,0,n){cout<<a[i]<<" ";} #define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n"; #define PI (2*acos(0)) const long long N = 1e6+5; vll visit,dist,taken; vector<vll> adj; vector<vii> adj2; priority_queue<ii,vector<ii>, greater<ii> > pq; ll bit[N][2]; ll siz; ll res = 0; ll lcm(ll a,ll b){return (a * b) / __gcd(a,b);} ll gcd(ll a,ll b){return __gcd(a,b);} long long power(long long a,long long b){if(b == 0)return 1;if(b == 1)return a;long long ans = power(a,b/2) % MOD;ans *= ans;ans %= MOD;if(b % 2 == 1)ans *= a;return ans%MOD;} ll inverse(ll x){x%=MOD;return power(x,MOD-2);} void BITup(ll k, ll x,ll pos){while(k <= siz){bit[k][pos]+=x;k += k & -k;}} ll BITq(ll k,ll pos){ll s=0;while(k>=1){s+=bit[k][pos];k -= k &-k;}return s;} struct node{ll lazy,val;}seg[4000000]; struct point{ll x,y;}; void dfs(ll v){visit[v] = 1;for(auto x:adj[v]){if(!visit[x])dfs(x);}} void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();ps(u);q.pop();for(auto x:adj[u]){if(!visit[x]){visit[x] = 1;q.push(x);}}}} void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}} void prim(ll edge) {taken[edge] = 1;for(auto v:adj2[edge]) {if (taken[v.first]==0)pq.push(ii(v.second, v.first));}} ll mst(ll s){taken.assign(N, 0);prim(s);ll cost = 0;while(!pq.empty()){ii front = pq.top();pq.pop();ll w = front.first;ll u = front.second;if(taken[u]==0)cost += w;prim(u);}return cost;} void YESNO(ll a){if(!!a){pl("Yes");}else{pl("No");}} void filesin(void){freopen("tracing.in","r",stdin);} void filesout(void){freopen("tracing.out","w",stdout);} ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Training string guess_sequence(int N){ int n = N; string ans = ""; string other = ""; string all = "ABXY"; if(press("AB")){ if(press("A")){ ans += "A"; } else{ ans += "B"; } } else{ if(press("X")){ ans += "X"; } else{ ans += "Y"; } } if(n == 1){ return ans; } for(auto x:all){ if(ans[0] != x){ other += x; } } while(ans.size() < n-1){ int val = press(ans+other[0]+ans+other[1]+other[0]+ans+other[1]+other[1]+ans+other[1]+other[2]); if(val == ans.size()+2){ ans += other[1]; } else if(val == ans.size()+1){ ans += other[0]; } else{ ans += other[2]; } } if(press(ans+other[0]) == n){ ans += other[0]; } else if(press(ans + other[1]) == n){ ans += other[1]; } else{ ans += other[2]; } return ans; }

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

combo.cpp: In function 'void dfs(ll)':
combo.cpp:46:20: error: reference to 'visit' is ambiguous
   46 |     void dfs(ll v){visit[v] = 1;for(auto x:adj[v]){if(!visit[x])dfs(x);}}
      |                    ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from combo.cpp:1:
/usr/include/c++/10/variant:1700:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)'
 1700 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
combo.cpp:31:9: note:                 'std::vector<long long int> visit'
   31 |     vll visit,dist,taken;
      |         ^~~~~
combo.cpp:46:56: error: reference to 'visit' is ambiguous
   46 |     void dfs(ll v){visit[v] = 1;for(auto x:adj[v]){if(!visit[x])dfs(x);}}
      |                                                        ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from combo.cpp:1:
/usr/include/c++/10/variant:1700:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)'
 1700 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
combo.cpp:31:9: note:                 'std::vector<long long int> visit'
   31 |     vll visit,dist,taken;
      |         ^~~~~
combo.cpp: In function 'void bfs(ll)':
combo.cpp:47:20: error: reference to 'visit' is ambiguous
   47 |     void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();ps(u);q.pop();for(auto x:adj[u]){if(!visit[x]){visit[x] = 1;q.push(x);}}}}
      |                    ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from combo.cpp:1:
/usr/include/c++/10/variant:1700:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)'
 1700 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
combo.cpp:31:9: note:                 'std::vector<long long int> visit'
   31 |     vll visit,dist,taken;
      |         ^~~~~
combo.cpp:47:126: error: reference to 'visit' is ambiguous
   47 |     void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();ps(u);q.pop();for(auto x:adj[u]){if(!visit[x]){visit[x] = 1;q.push(x);}}}}
      |                                                                                                                              ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from combo.cpp:1:
/usr/include/c++/10/variant:1700:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)'
 1700 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
combo.cpp:31:9: note:                 'std::vector<long long int> visit'
   31 |     vll visit,dist,taken;
      |         ^~~~~
combo.cpp:47:136: error: reference to 'visit' is ambiguous
   47 |     void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();ps(u);q.pop();for(auto x:adj[u]){if(!visit[x]){visit[x] = 1;q.push(x);}}}}
      |                                                                                                                                        ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from combo.cpp:1:
/usr/include/c++/10/variant:1700:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)'
 1700 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
combo.cpp:31:9: note:                 'std::vector<long long int> visit'
   31 |     vll visit,dist,taken;
      |         ^~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:89:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   89 |         while(ans.size() < n-1){
      |               ~~~~~~~~~~~^~~~~
combo.cpp:91:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   91 |             if(val == ans.size()+2){
      |                ~~~~^~~~~~~~~~~~~~~
combo.cpp:94:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   94 |             else if(val == ans.size()+1){
      |                     ~~~~^~~~~~~~~~~~~~~
combo.cpp: In function 'void filesin()':
combo.cpp:52:31: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |     void filesin(void){freopen("tracing.in","r",stdin);}
      |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
combo.cpp: In function 'void filesout()':
combo.cpp:53:32: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |     void filesout(void){freopen("tracing.out","w",stdout);}
      |                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~