Submission #784840

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7848402023-07-16 15:13:27jakobrsTracks in the Snow (BOI13_tracks)C++17
100 / 100
1871 ms1048576 KiB
#include <iostream>
#include <set>
#include <vector>
using i32 = int32_t;
struct UnionFind {
std::vector<i32> parent;
explicit UnionFind(size_t sz) : parent(sz, -1) {}
i32 find(i32 u) {
if (parent[u] < 0)
return u;
else
return parent[u] = find(parent[u]);
}
bool unite(i32 u, i32 v) {
u = find(u);
v = find(v);
if (u == v) {
return false;
} else {
if (-parent[u] < -parent[v])
std::swap(u, v);
parent[u] += parent[v];
parent[v] = u;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

tracks.cpp: In function 'int main()':
tracks.cpp:51:17: warning: unused variable 'row' [-Wunused-variable]
   51 |     const auto &row = grid[r];
      |                 ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...