Submission #1040077

#TimeUsernameProblemLanguageResultExecution timeMemory
1040077ProtonDecay314Friend (IOI14_friend)C++17
Compilation error
0 ms0 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<pi> vpi; typedef vector<pll> vpll; typedef vector<vpi> vvpi; typedef vector<vpll> vvpll; typedef vector<bool> vb; #define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++) #define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--) #define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++) #define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--) #define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci #define fi first #define se second #define pb push_back #define INF(type) numeric_limits<type>::max() #define NINF(type) numeric_limits<type>::min() #define TCASES int t; cin >> t; while(t--) // Find out best sample int findSample(int n,int confidence[],int host[],int protocol[]){ vvi adj; for(int i = 0; i < n; i++) { vi adjr; adj.pb(adjr); } for(int i = 1; i < n; i++) { if(protocol[i] == 0) { // I am your friend adj[i].pb(host[i]); adj[host[i]].pb(i); } else if(protocol[i] == 1) { // My friends are your friends for(int j : adj[host[i]]) { adj[i].pb(j); adj[j].pb(i); } } } vb(n, false); queue<pi> q; q.pb({0, 0}); int num0 = 0; while(!q.empty()) { auto [i, c] = q.front(); q.pop(); if(vis[i]) continue; vis[i] = true; if(c == 0) num0++; for(int j : adj[i]) { if(vis[j]) continue; q.pb({j, 1 - c}); } } return max(num0, n - num0); }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:24:12: error: 'class std::queue<std::pair<int, int> >' has no member named 'push_back'
   24 | #define pb push_back
      |            ^~~~~~~~~
friend.cpp:55:7: note: in expansion of macro 'pb'
   55 |     q.pb({0, 0});
      |       ^~
friend.cpp:63:12: error: 'vis' was not declared in this scope; did you mean 'vi'?
   63 |         if(vis[i]) continue;
      |            ^~~
      |            vi
friend.cpp:64:9: error: 'vis' was not declared in this scope; did you mean 'vi'?
   64 |         vis[i] = true;
      |         ^~~
      |         vi
friend.cpp:24:12: error: 'class std::queue<std::pair<int, int> >' has no member named 'push_back'
   24 | #define pb push_back
      |            ^~~~~~~~~
friend.cpp:69:15: note: in expansion of macro 'pb'
   69 |             q.pb({j, 1 - c});
      |               ^~