Submission #280142

#TimeUsernameProblemLanguageResultExecution timeMemory
280142SamAnd게임 (IOI14_game)C++17
42 / 100
1061 ms1556 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; #define m_p make_pair #define fi first #define se second #define all(x) (x).begin(),(x).end() #define sz(x) ((int)(x).size()) typedef long long ll; const int N = 1503; int n; bool a[N][N]; void initialize(int n) { ::n = n; for (int x = 1; x <= n; ++x) { for (int y = 1; y <= n; ++y) { a[x][y] = true; } } } bool c[N]; bool dfs(int x, int y, int xx, int yy) { c[x] = true; if (x == y) return true; for (int h = 1; h <= n; ++h) { if (x == xx && h == yy) continue; if (a[x][h]) { if (!c[h]) { if (dfs(h, y, xx, yy)) return true; } } } return false; } int hasEdge(int x, int y) { ++x; ++y; memset(c, false, sizeof c); if (dfs(x, y, x, y)) { a[x][y] = false; a[y][x] = false; return 0; } a[x][y] = false; a[y][x] = false; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...