이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Sasayego! Sasayego! Shinzou wo Sasageyo!
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bitset>
#include <ctime>
#include "coprobber.h"
#define debug(x) cerr << #x << " = " << x << endl
#define lid (id << 1)
#define rid (lid ^ 1)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
int arumin[MAX_N][MAX_N][2], eren[MAX_N][MAX_N];
int annie[MAX_N][MAX_N], deg[MAX_N], shingeki;
queue <int> Q;
int start(int n, bool A[MAX_N][MAX_N]){
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++)
if (A[i][j])
deg[i]++;
for (int j = 0; j < n; j++)
annie[j][i] = deg[i];
}
for (int i = 0; i < n; i++)
for (int b = 0; b < 2; b++){
arumin[i][i][b] = 1;
eren[i][i] = i;
Q.push(b * n * n + i * n + i);
}
while (!Q.empty()){
int x = Q.front();;
Q.pop();
bool b = (x >= n * n);
x -= b * n * n;
int att = x / n;
int fem = x % n;
if (b){
for (int u = 0; u < n; u++)
if (A[u][fem]){
annie[att][u]--;
if (annie[att][u] == 0 && !arumin[att][u][0]){
arumin[att][u][0] = 1;
Q.push(n * att + u);
}
}
}
else{
for (int u = 0; u < n; u++)
if ((A[u][att] || u == att) && !arumin[u][fem][1]){
arumin[u][fem][1] = 1;
eren[u][fem] = att;
Q.push(n * n + u * n + fem);
}
}
}
shingeki = -1;
for (int i = 0; i < n; i++){
bool flag = true;
for (int j = 0; j < n; j++)
flag &= (arumin[i][j][1]);
if (flag)
shingeki = i;
}
return shingeki;
}
int nextMove(int femaleTitan){
return shingeki = eren[shingeki][femaleTitan];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |