제출 #421951

#제출 시각아이디문제언어결과실행 시간메모리
421951SAAD게임 (IOI14_game)C++17
15 / 100
1 ms332 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...