This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAXN (1000005)
ll N;
vector<vector<ll> > edges;
void initialize(int n) {
N = n;
for(ll i = 0;i < N;i++){
vector<ll> col;
for(ll i = 0;i < N;i++){
col.push_back(1);
}
edges.push_back(col);
}
for(ll i = 0;i < N;i++){
edges[i][i] = 0;
}
}
int hasEdge(int u, int v) {
ll connectedtou = 0, connectedtov = 0;
for(ll i = 0;i < u;i++){
if(edges[u][i] == 1){
connectedtou++;
}
}
for(ll i = 0;i < v;i++){
if(edges[v][i] == 1){
connectedtov++;
}
}
if(connectedtou == 1 || connectedtov == 1){
return 1;
}else{
edges[u][v] = 0;
edges[v][u] = 0;
return 0;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |