This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define F first
#define S second
#define rep(i,a,b) for(int i=a;!(a==b&&i!=b)&&((i<=b&&b>=a)||(i>=b&&a>=b));i+=(a<=b?1:-1))
#define pb push_back
#define Fbitl __builtin_ffs
#define bit1 __builtin_popcount
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
int j , c , th[1502] , n , res ;
bool x[1502][1502] ;
void initialize(int n) {
::n = n ;
j = n*(n-1)/2;
}
int hasEdge(int u, int v) {
c++;
if( v < u ) swap(v,u) ;
th[u]++;th[v]++;
if ( j-(n-1-res) < c ) {
return 1 ;
}
if ( (th[u] != n-1 && th[v] != n-1) ) {
return 0 ;
}
else {
x[u][v] = x[v][u] = 1 ;
res++;
return 1 ;
}
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... |