Submission #983861

# Submission time Handle Problem Language Result Execution time Memory
983861 2024-05-16T07:30:23 Z vjudge1 Game (APIO22_game) C++17
Compilation error
0 ms 0 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

#define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define rall(s) s.rbegin(),s.rend()
#define all(s) s.begin(),s.end()
#define pb push_back
#define se second
#define fi first
#define ll long long
#define ld long double
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define no cout<<"no\n"


const int N = 1e4 + 9 , mod = 1e9 + 7;
bool a[N][1009][2];
vector<int>v[N][1009][2] ;

int n , k;
int ans = 0;

void get(int x , int y , int f){
    a[x][y][f] = 1;
    for(auto to : v[x][y][f])
        if(!a[to][y][f])
            get(to , y , f);
    v[x][y][f].clear();
}



void init(int n,  int k){
    ::n = n , ::k = k;
    for(int i = 1; i <= k; i++)
        a[i][i][0] = a[i][i][1] = 1;
    for(int i = 1; i < k; i++){
        for(int j = 1; j <= k; j++){
            if(!a[i + 1][j][0])
                v[i][j][0].pb(i + 1);
            if(!a[i][j][1])
                v[i + 1][j][1].pb(i);
            if(a[i][j][0])
                get(i ,  j ,0);
            if(a[i + 1][j][1])
                get(i + 1,j , 1);
            }
    }
}

int add_teleport(int u , int v){
    if(ans == 1)
        return ans;
    int x = u , y = v;
    x++ , y++;
    for(int i = 1; i <= k; i++){
        if(!a[y][i][0])
            ::v[x][i][0].pb(y);
        if(!a[x][i][1])
            ::v[y][i][1].pb(x);
        if(a[x][i][0] && a[y][i][1])
            ans = 1;
        if(a[x][i][0])
            get(x , i , 0);
        if(a[y][i][1])
            get(y , i ,  1);
    }
    return ans;
}
/*
int main(){
    TL;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    init(6 , 3);
    cout<<add_teleport(3 , 4)<<"\n";
    cout<<add_teleport(5 , 0)<<"\n";
    cout<<add_teleport(4 , 5)<<"\n";
    cout<<add_teleport(5 , 3)<<"\n";
    cout<<add_teleport(1 , 4)<<"\n";

}*/
// Author : حسن

Compilation message

/usr/bin/ld: /tmp/ccGzyYfN.o: in function `main':
stub.cpp:(.text.startup+0xda): undefined reference to `add_teleporter(int, int)'
collect2: error: ld returned 1 exit status