Submission #1091166

#TimeUsernameProblemLanguageResultExecution timeMemory
1091166IzzyAdvertisement 2 (JOI23_ho_t2)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <queue> using namespace std; int n; vector<int> visited; vector<pair<int, int>> res; //just count how many graphs there are void traverse(int start) { queue<int> q; q.push(start); visited[start] = false; int a; while (!q.empty()) { a = q.front(); q.pop(); for (int i = -1 * res[i].second; i <= res[i].second; i++) { if (a + i >= 0 && a + i < n) { if (!visited[a + i] && abs(res[a].first - res[a + i].first) <= res[a].second - res[a + i].second) { visited[a + i] = true; q.push(a + i) } else { continue; } } else { break; } } } } int main() { cin >> n; pair<int, int> temp; for (int i = 0; i < n; i++) { cin >> temp.first; cin >> temp.second; res.push_back(temp); visited.push_back(false); } int count = 0; for (int i = 0; i < n; i++) { if (!visited[i]) { traverse(i); count++; } } cout << count; }

Compilation message (stderr)

Main.cpp: In function 'void traverse(int)':
Main.cpp:22:34: error: expected ';' before '}' token
   22 |                     q.push(a + i)
      |                                  ^
      |                                  ;
   23 |                 }
      |                 ~