Submission #436764

#TimeUsernameProblemLanguageResultExecution timeMemory
436764David_MKeys (IOI21_keys)C++17
Compilation error
0 ms0 KiB
#include "keys.h"
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int, int>
#define pb push_back
const int N=300005;
vector<pii> V[N];
pair<int, int> ans[N];

vi find_reachable(vi r, vi u, vi v, vi c){
	int n=r.size(), m=u.size();
	int Ans[n];


	for(int j=0; j<m; j++){
	    int x=u[j], y=v[j], C=c[j];
		V[x].pb({y,C});
		V[y].pb({x,C});
	}

	for (int i=0; i<n; i++){
        bool C[n];
        vi vv[n];
        C[r[i]]=true;
        queue<int> q;
        q.push(i);
        while(!q.empty()){ans[i].F++;
            int x=q.top();
            q.pop();
            for (auto [y,c]:V[x]) if(!C[c])vv[c].pb(y); else q.push(y);
            if(!C[r[x]]){for (auto k:vv[r[x]])q.push(k); C[r[i]]=true;}
        }
	}
	sort(ans, ans+n);
	int R=ans[0].F, o=0;
	while(ans[o].F==R){
        Ans[ans[o].S]=1;
        o++;
	}
	return Ans;
}

Compilation message (stderr)

keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:28:34: error: 'struct std::pair<int, int>' has no member named 'F'
   28 |         while(!q.empty()){ans[i].F++;
      |                                  ^
keys.cpp:29:21: error: 'class std::queue<int>' has no member named 'top'; did you mean 'pop'?
   29 |             int x=q.top();
      |                     ^~~
      |                     pop
keys.cpp:36:15: error: 'struct std::pair<int, int>' has no member named 'F'
   36 |  int R=ans[0].F, o=0;
      |               ^
keys.cpp:37:12: error: 'o' was not declared in this scope
   37 |  while(ans[o].F==R){
      |            ^
keys.cpp:41:9: error: could not convert 'Ans' from 'int [n]' to 'std::vector<int>'
   41 |  return Ans;
      |         ^~~
      |         |
      |         int [n]