Submission #1004336

#TimeUsernameProblemLanguageResultExecution timeMemory
1004336aykhnTrobojnica (COCI19_trobojnica)C++17
Compilation error
0 ms0 KiB
a#include <bits/stdc++.h> using namespace std; #define inf 0x3F3F3F3F3F3F3F3F const int MXN = 20 + 5; const int mod = 1e9 + 7; const int LOG = 20; int n; vector<array<int, 3>> res; int ok(vector<array<int, 3>> &v) { if (v.size() == 3) { return v[0][0] != v[1][0] && v[0][0] != v[2][0] && v[1][0] != v[2][0]; } int cnt = 0; for (int i = 0; i < v.size(); i++) { if (v[i][0] != v[(i + 1) % (int)v.size()][0]) { vector<array<int, 3>> nw; for (int j = 0; j < v.size(); j++) { if (j != i && j != (i + 1) % (int)v.size()) { nw.push_back(v[j]); } else if (j == i) { nw.push_back({6 - v[i][0] - v[(i + 1) % (int)v.size()][0], v[i][1], v[(i + 1) % (int)v.size()][2]}); } } if (ok(nw)) { res.push_back({v[i][1], v[(i + 1) % (int)v.size()][2], 6 - v[i][0] - v[(i + 1) % (int)v.size()][0]}); return 1; } else if (++cnt == 2) return 0; } } return 0; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; vector<array<int, 3>> v; for (int i = 0; i < n; i++) { char ch; cin >> ch; v.push_back({ch - '0', i + 1, (i + 1) % n + 1}); } if (!ok(v)) cout << "NE\n"; else { cout << "DA\n"; for (array<int, 3> &x : res) cout << x[0] << ' ' << x[1] << ' ' << x[2] << '\n'; } }

Compilation message (stderr)

trobojnica.cpp:1:2: error: stray '#' in program
    1 | a#include <bits/stdc++.h>
      |  ^
trobojnica.cpp:1:1: error: 'a' does not name a type
    1 | a#include <bits/stdc++.h>
      | ^
trobojnica.cpp:12:1: error: 'vector' does not name a type
   12 | vector<array<int, 3>> res;
      | ^~~~~~
trobojnica.cpp:14:8: error: 'vector' was not declared in this scope
   14 | int ok(vector<array<int, 3>> &v)
      |        ^~~~~~
trobojnica.cpp:14:15: error: 'array' was not declared in this scope
   14 | int ok(vector<array<int, 3>> &v)
      |               ^~~~~
trobojnica.cpp:14:21: error: expected primary-expression before 'int'
   14 | int ok(vector<array<int, 3>> &v)
      |                     ^~~
trobojnica.cpp:14:31: error: 'v' was not declared in this scope
   14 | int ok(vector<array<int, 3>> &v)
      |                               ^
trobojnica.cpp:14:32: error: expression list treated as compound expression in initializer [-fpermissive]
   14 | int ok(vector<array<int, 3>> &v)
      |                                ^
trobojnica.cpp: In function 'int main()':
trobojnica.cpp:51:3: error: 'ios_base' has not been declared
   51 |   ios_base::sync_with_stdio(0);
      |   ^~~~~~~~
trobojnica.cpp:52:3: error: 'cin' was not declared in this scope
   52 |   cin.tie(0);
      |   ^~~
trobojnica.cpp:54:3: error: 'vector' was not declared in this scope
   54 |   vector<array<int, 3>> v;
      |   ^~~~~~
trobojnica.cpp:54:10: error: 'array' was not declared in this scope
   54 |   vector<array<int, 3>> v;
      |          ^~~~~
trobojnica.cpp:54:16: error: expected primary-expression before 'int'
   54 |   vector<array<int, 3>> v;
      |                ^~~
trobojnica.cpp:59:5: error: 'v' was not declared in this scope
   59 |     v.push_back({ch - '0', i + 1, (i + 1) % n + 1});
      |     ^
trobojnica.cpp:61:11: error: 'v' was not declared in this scope
   61 |   if (!ok(v)) cout << "NE\n";
      |           ^
trobojnica.cpp:61:12: error: 'ok' cannot be used as a function
   61 |   if (!ok(v)) cout << "NE\n";
      |            ^
trobojnica.cpp:61:15: error: 'cout' was not declared in this scope
   61 |   if (!ok(v)) cout << "NE\n";
      |               ^~~~
trobojnica.cpp:64:5: error: 'cout' was not declared in this scope
   64 |     cout << "DA\n";
      |     ^~~~
trobojnica.cpp:65:16: error: expected primary-expression before 'int'
   65 |     for (array<int, 3> &x : res) cout << x[0] << ' ' << x[1] << ' ' << x[2] << '\n';
      |                ^~~
trobojnica.cpp:66:3: error: expected primary-expression before '}' token
   66 |   }
      |   ^
trobojnica.cpp:65:85: error: expected ';' before '}' token
   65 |     for (array<int, 3> &x : res) cout << x[0] << ' ' << x[1] << ' ' << x[2] << '\n';
      |                                                                                     ^
      |                                                                                     ;
   66 |   }
      |   ~                                                                                  
trobojnica.cpp:66:3: error: expected primary-expression before '}' token
   66 |   }
      |   ^
trobojnica.cpp:65:85: error: expected ')' before '}' token
   65 |     for (array<int, 3> &x : res) cout << x[0] << ' ' << x[1] << ' ' << x[2] << '\n';
      |         ~                                                                           ^
      |                                                                                     )
   66 |   }
      |   ~                                                                                  
trobojnica.cpp:66:3: error: expected primary-expression before '}' token
   66 |   }
      |   ^