Submission #1083299

#TimeUsernameProblemLanguageResultExecution timeMemory
1083299Math4Life2020Simurgh (IOI17_simurgh)C++17
Compilation error
0 ms0 KiB
// Source: https://usaco.guide/general/io #include <bits/stdc++.h> #include <cinttypes> #include <cstdio> using namespace std; vector<int> find_roads(int N, vector<int> u, vector<int> v) { ll M = u.size(); vector<vector<int>> combs = {{-1}}; for (ll i=0;i<(N-1);i++) { vector<vector<int>> combs2; for (vector<int> v1: combs) { for (ll e=(v1[v1.size()-1]+1);e<M;e++) { vector<int> v2 = v1; v2.push_back(e); combs2.push_back(v2); } } combs = combs2; } for (vector<int> v1: combs) { vector<int> v; for (ll i=1;i<N;i++) { v.push_back(v1[i]); } ll f[N]; for (ll i=0;i<N;i++) { f[i]=i; } bool valid = 1; for (ll x: v) { ll a = u[x]; ll b=v[x]; while (a != f[a]) { f[a]=a; } while (b != f[b]) { f[b]=b; } if (a==b) { valid = 0; break; } else { f[a]=b; } } if (valid) { ll a0 = count_common_roads(v); if (a0 == (N-1)) { return v; } } } }

Compilation message (stderr)

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:9:2: error: 'll' was not declared in this scope
    9 |  ll M = u.size();
      |  ^~
simurgh.cpp:11:9: error: expected ';' before 'i'
   11 |  for (ll i=0;i<(N-1);i++) {
      |         ^~
      |         ;
simurgh.cpp:11:14: error: 'i' was not declared in this scope
   11 |  for (ll i=0;i<(N-1);i++) {
      |              ^
simurgh.cpp:14:11: error: expected ';' before 'e'
   14 |    for (ll e=(v1[v1.size()-1]+1);e<M;e++) {
      |           ^~
      |           ;
simurgh.cpp:14:34: error: 'e' was not declared in this scope
   14 |    for (ll e=(v1[v1.size()-1]+1);e<M;e++) {
      |                                  ^
simurgh.cpp:14:36: error: 'M' was not declared in this scope
   14 |    for (ll e=(v1[v1.size()-1]+1);e<M;e++) {
      |                                    ^
simurgh.cpp:23:10: error: expected ';' before 'i'
   23 |   for (ll i=1;i<N;i++) {
      |          ^~
      |          ;
simurgh.cpp:23:15: error: 'i' was not declared in this scope
   23 |   for (ll i=1;i<N;i++) {
      |               ^
simurgh.cpp:26:5: error: expected ';' before 'f'
   26 |   ll f[N];
      |     ^~
      |     ;
simurgh.cpp:27:10: error: expected ';' before 'i'
   27 |   for (ll i=0;i<N;i++) {
      |          ^~
      |          ;
simurgh.cpp:27:15: error: 'i' was not declared in this scope
   27 |   for (ll i=0;i<N;i++) {
      |               ^
simurgh.cpp:28:4: error: 'f' was not declared in this scope
   28 |    f[i]=i;
      |    ^
simurgh.cpp:31:10: error: expected ';' before 'x'
   31 |   for (ll x: v) {
      |          ^~
      |          ;
simurgh.cpp:45:3: error: expected primary-expression before 'if'
   45 |   if (valid) {
      |   ^~
simurgh.cpp:44:4: error: expected ';' before 'if'
   44 |   }
      |    ^
      |    ;
   45 |   if (valid) {
      |   ~~
simurgh.cpp:45:3: error: expected primary-expression before 'if'
   45 |   if (valid) {
      |   ^~
simurgh.cpp:44:4: error: expected ')' before 'if'
   44 |   }
      |    ^
      |    )
   45 |   if (valid) {
      |   ~~
simurgh.cpp:31:7: note: to match this '('
   31 |   for (ll x: v) {
      |       ^
simurgh.cpp:46:6: error: expected ';' before 'a0'
   46 |    ll a0 = count_common_roads(v);
      |      ^~~
      |      ;
simurgh.cpp:47:8: error: 'a0' was not declared in this scope; did you mean 'y0'?
   47 |    if (a0 == (N-1)) {
      |        ^~
      |        y0