Submission #252543

#TimeUsernameProblemLanguageResultExecution timeMemory
252543fivefourthreeoneCop and Robber (BOI14_coprobber)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gp_hash_table<int, int> mp;*/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 501;
int st = -1;
int adj[mxN][mxN];
int cnt[mxN];
int num[mxN][mxN];
bool flag[mxN][mxN];
bool state[mxN][mxN][2];
//state = [cop_pos, robber_pos]
//0 is cop's turn
//1 is robber's turn
int n;
int start(int N, vector<vector<bool>> A) {
    n= N;
    queue<array<int, 3>> Q;
    owo(i, 0, n) {
        owo(j, 0, n) {
            adj[i][j] = A[i][j];
            cnt[i]+=adj[i][j];
        }
        state[i][i][0] = true;
        state[i][i][1] = true;
        Q.push({i, i, 0});
        Q.push({i, i, 1});
    }
    while(!Q.empty()) {
        auto p = Q.front();
        Q.pop();
        if(p[2]==0) {
            owo(i, 0, n) {
                if(adj[p[1]][i]) {
                    if(state[p[0]][i][1])continue;
                    num[p[0]][i]++;
                    if(num[p[0]][i]==cnt[i]) {
                        state[p[0]][i][1] = true;
                        Q.push({p[0], i, 1});
                    }
                }
            }
        }else {
            owo(i, 0, n) {
                if(adj[p[0]][i]) {
                    if(state[i][p[1]][0])continue;
                    state[i][p[1]][0] = true;
                    Q.push({i, p[1], 0});
                }
            }
        }
    }
    owo(i, 0, n) {
        owo(j, 0, n) {
            if(!state[i][j][0])break;
            if(j==n-1)st = i;
        }
    }
    return st;
}
int nextMove(int rpos) {
    owo(i, 0, n) {
        if(adj[st][i]&&state[rpos][i][1]&&!flag[rpos][i]) {
            flag[rpos][i] = true;
            return st=i;
        }
    }
}
int NN;
vector<vector<bool>> ok;
int main()
{   
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    /*cin>>NN;
    ok.resize(NN);
    owo(i, 0, NN) {
        ok[i].resize(NN);
    }
    int a;
    owo(i, 0, NN) {
        owo(j, 0, NN) {
            cin>>a;
            ok[i][j] = a;
        }
    }
    int nxt = start(NN, ok);
    if(nxt==-1)ayaya;
    else {
        int curr = -1;
        while(curr!=st) {
            cout<<"cop: "<<st<<endl;
            cin>>curr;
            nextmove(curr);
        }
    }*/
    return 0;
}

Compilation message (stderr)

coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:87:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/tmp/ccprHxH5.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cchHGoLh.o:coprobber.cpp:(.text.startup+0x0): first defined here
/tmp/ccprHxH5.o: In function `main':
grader.cpp:(.text.startup+0x13c): undefined reference to `start(int, bool (*) [500])'
collect2: error: ld returned 1 exit status