Submission #1014277

#TimeUsernameProblemLanguageResultExecution timeMemory
1014277thangdz2k7Meetings (JOI19_meetings)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "meetings.h" using namespace std; void Ans(int u, int v){ if (u < v) Bridge(u, v); else Bridge(v, u); } void Solve(vector <int> v){ if (v.size() < 2) return; random_shuffle(v.begin(), v.end()); int l = v[0], r = v[1]; map <int, vector <int>> m; vector <int> path; for (auto k : v){ if (k == l || k == r) continue; int x = Query(l, r, k); if (!m.count(x)) path.push_back(x); m[x].push_back(v[i]); } sort(path.begin(), path.end(), [&](int x, int y){ return Query(v[0], x, y) == x; }); int last = v[0]; for (auto k : path) Ans(last, k), last = k; Ans(last, v[1]); for (auto it : m) Solve(it.second); } void Solve(int n){ srand(time(0)); vector <int> cur(n, 0); for (int i = 1; i < n; ++ i) cur[i] = i; Solve(cur); }

Compilation message (stderr)

meetings.cpp: In function 'void Solve(std::vector<int>)':
meetings.cpp:21:26: error: 'i' was not declared in this scope
   21 |         m[x].push_back(v[i]);
      |                          ^