이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
const int nax = 1500;
int g[nax][nax], f[nax][nax];
int n;
set<int> rem[nax+5];
void initialize(int N) {
n = N;
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++) {
if(i!=j) g[i][j] = 1;
f[i][j] = 0;
}
}
}
bool anyIsolated() {
for(int i=0; i<n; i++) {
int cnt = 0;
for(int j=0; j<n; j++) {
cnt += g[i][j];
}
if(cnt == 0) return true;
}
return false;
}
bool allConnected() {
vector<bool> vis(n, false);
function <void(int)> rec = [&] (int node) {
vis[node] = true;
for(int i=0; i<n; i++) {
if(vis[i] == false && f[node][i] == 1) {
rec(i);
}
}
};
for(auto u : vis) if(!u) return false;
return true;
}
int hasEdge(int u, int v) {
//coba jawab no
g[u][v] = g[v][u] = 0;
if(anyIsolated()) {
g[u][v] = g[v][u] = 1;
f[u][v] = f[v][u] = 1;
}
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++) {
cout << f[i][j];
}
cout << endl;
}
return g[u][v];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |