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>
#include "game.h"
using namespace std;
int n, edge = 0, cnt = 0;
vector<int>degrees;
void initialize(int N) {
n = N;
degrees.resize(n);
}
int hasEdge(int u, int v) {
degrees[u]++;
degrees[v]++;
cnt++;
if(edge + cnt == n * (n - 1) / 2 || degrees[u] >= n - 1 || degrees[v] >= n - 1){
return 1;
edge++;
}
return 0;
}
//int main()
//{
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// int n;
// cin >> n;
// int cnt = n;
// initialize(n);
// vector<vector<bool>>grid(n, vector<bool>(n));
// for(int i = 0;i < n;++i)grid[i][i] = 1;
// while(cnt < n * n){
// int i = rng() % n;
// int j = rng() % n;
// if(!grid[i][j]){
// cout << "(" << i << ", " << j << "): " << hasEdge(i, j) << '\n';
// grid[i][j] = 1;
// grid[j][i] = 1;
// cnt += 2;
// }
// }
//}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |