# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
947607 |
2024-03-16T15:21:39 Z |
Roupiq |
Game (IOI14_game) |
C++17 |
|
1 ms |
600 KB |
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
#define len(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pb push_back
#define x first
#define y second
int n;
vi p, s;
int Find(int v)
{
if(p[v] == v)
return v;
return p[v] = Find(p[v]);
}
void Union(int u, int v)
{
u = Find(u);
v = Find(v);
if(u == v)
return;
s[u] += s[v];
p[v] = u;
}
void initialize(int n)
{
p.resize(n);
s.resize(n, n - 1);
for (int i = 0; i < n; i++)
p[i] = i;
}
int hasEdge(int u, int v)
{
s[u]--;
s[v]--;
if(s[u] == 0 || s[v] == 0)
{
Union(u, v);
return 1;
}
return 0;
}
/*
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
600 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |