Submission #883759

# Submission time Handle Problem Language Result Execution time Memory
883759 2023-12-06T00:13:13 Z MilosMilutinovic Towns (IOI15_towns) C++14
Compilation error
0 ms 0 KB
vector<int> vec;
    while (ids.size() > 1) {
      vector<int> new_ids;
      for (int i = 0; i + 1 < (int) ids.size(); i += 2) {
        if (Diff(ids[i], ids[i + 1])) {
          // ...
        } else {
          Merge(ids[i], ids[i + 1]);
          new_ids.push_back(ids[i]);
        }
      }
      swap(ids, new_ids);
    }
    if (ids.empty()) {
      return true;
    }
    int e = ids.back();
    iota(par.begin(), par.end(), 0);
    sz = vector<int>(n, 1);
    for (int i = 0; i < n; i++) {
      if (i != Get(i) || i == Get(e)) {
        continue;
      }
      if (!Diff(i, e)) {
        Merge(i, e);
      }
    }
    return *max_element(sz.begin(), sz.end()) <= n / 2;

Compilation message

towns.cpp:1:1: error: 'vector' does not name a type
    1 | vector<int> vec;
      | ^~~~~~
towns.cpp:2:5: error: expected unqualified-id before 'while'
    2 |     while (ids.size() > 1) {
      |     ^~~~~
towns.cpp:14:5: error: expected unqualified-id before 'if'
   14 |     if (ids.empty()) {
      |     ^~
towns.cpp:17:13: error: 'ids' was not declared in this scope
   17 |     int e = ids.back();
      |             ^~~
towns.cpp:18:9: error: expected constructor, destructor, or type conversion before '(' token
   18 |     iota(par.begin(), par.end(), 0);
      |         ^
towns.cpp:19:5: error: 'sz' does not name a type
   19 |     sz = vector<int>(n, 1);
      |     ^~
towns.cpp:20:5: error: expected unqualified-id before 'for'
   20 |     for (int i = 0; i < n; i++) {
      |     ^~~
towns.cpp:20:21: error: 'i' does not name a type
   20 |     for (int i = 0; i < n; i++) {
      |                     ^
towns.cpp:20:28: error: 'i' does not name a type
   20 |     for (int i = 0; i < n; i++) {
      |                            ^
towns.cpp:28:5: error: expected unqualified-id before 'return'
   28 |     return *max_element(sz.begin(), sz.end()) <= n / 2;
      |     ^~~~~~