Submission #346535

#TimeUsernameProblemLanguageResultExecution timeMemory
346535saleh경찰관과 강도 (BOI14_coprobber)C++17
0 / 100
1 ms512 KiB
#include "coprobber.h" #include <bits/stdc++.h> #define ft first #define sd second using namespace std; typedef pair<int, int> pii; typedef pair<int, pii> tip; const int MAXN = 500 + 3; int st, dd[MAXN], d[MAXN][MAXN], par[MAXN][MAXN]; queue<tip> q; bitset<MAXN> mark[2 + 1][MAXN]; int start(int n, bool a[MAX_N][MAX_N]) { return 8; for (int i = 0; i < 2; i++) for (int j = 0; j < n; j++) { q.push({i, {j, j}}); mark[i][j][j] = true; } for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) dd[i] += a[i][j]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) d[i][j] = dd[j]; while (!q.empty()) { tip x = q.front(); q.pop(); if (x.ft == 0) { for (int i = 0; i < n; i++) if (a[i][x.sd.sd]) if (--d[x.sd.ft][i] == 0 && !mark[1][x.sd.ft][i]) { q.push({1, {x.sd.ft, i}}); mark[1][x.sd.ft][i] = true; } } else { for (int i = 0; i < n; i++) if (i == x.sd.ft || a[i][x.sd.ft] == 1) if (!mark[0][i][x.sd.sd]) { q.push({0, {i, x.sd.sd}}); par[i][x.sd.sd] = x.sd.ft; mark[0][i][x.sd.sd] = true; } } } for (int i = 0; i < n; i++) { bool z = true; for (int j = 0; j < n; j++) z &= mark[0][i][j]; if (z) return st = i; } return -1; } int nextMove(int r) { return 12; return st = par[st][r]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...