| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 876214 | aykhn | Game (IOI14_game) | C++17 | 1022 ms | 2900 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
// author : aykhn
using namespace std;
typedef long long ll;
#define pb push_back
#define pf push_front
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcountll
#define pii pair<ll, ll>
#define pll pair<ll, ll>
#define fi first
#define se second
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
int n;
vector<int> adj[1500];
vector<int> used;
void initialize(int N)
{
n = N;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (i == j) continue;
adj[i].pb(j);
}
}
}
void dfs(int a)
{
used[a] = 1;
for (int v : adj[a])
{
if (used[v]) continue;
dfs(v);
}
}
bool check()
{
used.assign(n, 0);
dfs(1);
for (int i = 0; i < n; i++)
{
if (!used[i]) return 0;
}
return 1;
}
int hasEdge(int u, int v)
{
for (int i = 0; i < adj[u].size(); i++)
{
if (adj[u][i] == v)
{
adj[u].erase(adj[u].begin() + i);
break;
}
}
for (int i = 0; i < adj[v].size(); i++)
{
if (adj[v][i] == u)
{
adj[v].erase(adj[v].begin() + i);
break;
}
}
if (check()) return 0;
adj[u].pb(v);
adj[v].pb(u);
return 1;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
