| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 876239 | aykhn | 게임 (IOI14_game) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
int cnt;
void initialize(int N)
{
cnt = 0;
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)
{
cnt++;
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 (cnt <= n - 2 || check()) return 0;
adj[u].pb(v);
adj[v].pb(u);
cnt = 0;
return 1;
}
컴파일 시 표준 에러 (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... | ||||
