제출 #1275975

#제출 시각아이디문제언어결과실행 시간메모리
1275975avohado게임 (IOI14_game)C++20
0 / 100
1 ms340 KiB
#include <bits/stdc++.h>
#include "game.h"
using namespace std;
#define mod 1000000007
#define maxn 200005
#define f first
#define s second
#define ll long long
#define pb(x) push_back(x)
int t[1501][1501], p[1501], n1;
void initialize(int n){
    n1=n;
    for(int i=1; i<=n; i++){
        p[i]=i;
        for(int j=1; j<=n; j++){
            t[i][j]=i!=j;
        }
    }
}
int bck(int u){
    if(p[u]==u){
        return u;
    }
    p[u]=bck(p[u]);
    return p[u];
}
int hasEdge(int u, int v){
    if(bck(u)>bck(v)){
        swap(u, v);
    }
    if(t[p[u]][p[v]]>1){
        t[p[u]][p[v]]--;
        t[p[v]][p[u]]--;
        return 0;
    }else{
        t[p[u]][p[v]]--;
        t[p[v]][p[u]]--;
        for(int i=1; i<=n1; i++){
            t[p[u]][i]+=t[p[v]][i];
            t[i][p[u]]+=t[p[v]][i];
        }
        p[p[v]]=p[u];
        return 1;
    }
}
/*int main(){
    int n;
    cin >> n;
    initialize(n);
    for(int i=0; i<n*(n-1)/2; i++){
        int u, v;
        cin >> u >> v; u++;v++;
        cout << hasEdge(u, v);
    }
}*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...