Submission #365197

#TimeUsernameProblemLanguageResultExecution timeMemory
365197CodeKrackerStations (IOI20_stations)C++14
Compilation error
0 ms0 KiB
/*input */ /** Author: Kristopher Paul Date Created: 11-02-2021 **/ #include<bits/stdc++.h> #include<stdio.h> //#include<unordered_map> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define ll long long #define int ll #define pb push_back #define INF 1e18 #define MOD 1000000007 //#define MOD 998244353 #define mp make_pair const double PI=3.141592653589793238462643383279502884197169399375105820974944; #define REP(i,n) for (int i = 0; i < n; i++) #define FOR(i,a,b) for (int i = a; i < b; i++) #define REPD(i,n) for (int i = n-1; i >= 0; i--) #define FORD(i,a,b) for (int i = a; i >= b; i--) #define remax(a,b) a = max(a,b) #define remin(a,b) a = min(a,b) #define umap map #define pii pair<int,int> #define F first #define S second #define mii map<int,int> //#define vi vector<int> #define vvi vector<vi> #define itr :: iterator it #define all(v) v.begin(),v.end() #define WL(t) while(t--) #define gcd(a,b) __gcd((a),(b)) #define lcm(a,b) ((a)*(b))/gcd((a),(b)) #define out(x) cout << #x << " is " << x << endl #define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); using namespace std; //using namespace __gnu_pbds; //typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set //typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset int ModExp(int x,int y,int m){ int res = 1; x = x % m; while (y > 0) { if (y & 1) res = (res*x) % m; y = y>>1; x = (x*x) % m; } return res; } vi adj[1005]; int val[1005]; int dfs(int cv,int p,int c){ FOR(i,0,adj[cv].size()){ if(adj[cv][i] != p){ c = dfs(adj[cv][i],cv,c); } } val[cv] = c; return c+1; } vi label(int n,int k,vi u,vi v){ FOR(i,0,n){ adj[i].clear(); } FOR(i,0,n-1){ adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } dfs(0,-1,0); vi ans; FOR(i,0,n){ ans.pb(val[i]); } return ans; } int find_next_station(int s,int t,vi c){ if(t <= c[0]){ return c[0]; }else if(t <= c[1]){ return c[1]; }else{ return c[2]; } }

Compilation message (stderr)

stations.cpp:62:1: error: 'vi' does not name a type; did you mean 'vvi'?
   62 | vi adj[1005];
      | ^~
      | vvi
stations.cpp: In function 'long long int dfs(long long int, long long int, long long int)':
stations.cpp:66:13: error: 'adj' was not declared in this scope
   66 |     FOR(i,0,adj[cv].size()){
      |             ^~~
stations.cpp:22:40: note: in definition of macro 'FOR'
   22 | #define FOR(i,a,b) for (int i = a; i < b; i++)
      |                                        ^
stations.cpp: At global scope:
stations.cpp:75:1: error: 'vi' does not name a type; did you mean 'vvi'?
   75 | vi label(int n,int k,vi u,vi v){
      | ^~
      | vvi
stations.cpp:91:35: error: 'vi' has not been declared
   91 | int find_next_station(int s,int t,vi c){
      |                                   ^~
stations.cpp: In function 'long long int find_next_station(long long int, long long int, int)':
stations.cpp:92:16: error: invalid types 'int[int]' for array subscript
   92 |     if(t <= c[0]){
      |                ^
stations.cpp:93:19: error: invalid types 'int[int]' for array subscript
   93 |         return c[0];
      |                   ^
stations.cpp:94:22: error: invalid types 'int[int]' for array subscript
   94 |     }else if(t <= c[1]){
      |                      ^
stations.cpp:95:19: error: invalid types 'int[int]' for array subscript
   95 |         return c[1];
      |                   ^
stations.cpp:97:19: error: invalid types 'int[int]' for array subscript
   97 |         return c[2];
      |                   ^