Submission #1147823

#TimeUsernameProblemLanguageResultExecution timeMemory
1147823FaresSTHStations (IOI20_stations)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; #define int long long #define mp make_pair #define S second #define F first vecotr<int> adj[1000]; int dt[1000], t; void dfs(int i) { dt[i] = ++t; for (int j : adj[i]) { if (dt[j]) continue; dfs(j); } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for (int i = 0; i < n - 1; i++) { adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } int rt; for (int i = 0; i < n; i++) if (adj[i].size() == 1) rt = i; dfs(rt); vector<int> res; for (int i = 0; i < n; i++) { res.push_back(dt[i] - 1); adj[i].clear(); dt[i] = 0; } return res; } int find_next_station(int s, int t, vector<int> c) { int res; if (s < t) for (int i : c) if (i > s) res = i; else for (int i : c) if (i < s) res = i; return res; }

Compilation message (stderr)

stations.cpp:7:1: error: 'vecotr' does not name a type
    7 | vecotr<int> adj[1000];
      | ^~~~~~
stations.cpp: In function 'void dfs(long long int)':
stations.cpp:12:18: error: 'adj' was not declared in this scope
   12 |     for (int j : adj[i]) {
      |                  ^~~
stations.cpp: In function 'std::vector<long long int> label(long long int, long long int, std::vector<long long int>, std::vector<long long int>)':
stations.cpp:20:9: error: 'adj' was not declared in this scope
   20 |         adj[u[i]].push_back(v[i]);
      |         ^~~
stations.cpp:23:45: error: 'adj' was not declared in this scope
   23 |     int rt; for (int i = 0; i < n; i++) if (adj[i].size() == 1) rt = i;
      |                                             ^~~
stations.cpp:27:9: error: 'adj' was not declared in this scope
   27 |         adj[i].clear();
      |         ^~~