Submission #556299

# Submission time Handle Problem Language Result Execution time Memory
556299 2022-05-02T20:03:34 Z new_acc Cop and Robber (BOI14_coprobber) C++14
0 / 100
42 ms 2996 KB
#include "coprobber.h"
#include<bits/stdc++.h>
#define fi first
#define se second
#define pitem item*
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=500;
const int SS=1<<19;
const int INFi=2e9;
const ll INFl=1e13;
const ll mod2=998244353;
const ll mod=1e9+7;
const ll mod3=1000696969;
const ll p=70032301;
const ull p2=913;
const int L=20;
struct st{
    int a,b,c;
};
bool dp[N][N][2];
int nxt[N][N],il[N],last;
vi graf[N];
int start(int n, bool t[N][N]){
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)
            if(t[i][j]) graf[i].push_back(j);
    }
    deque<st>deq;
    for(int i=1;i<=n;i++)
        deq.push_back({i,i,0}),deq.push_back({i,i,1});
    while(deq.size()){
        st v=deq.front();
        deq.pop_front();
        dp[v.a][v.b][v.c]=1;
        if(v.c){
            for(auto u:graf[v.b]){
                il[u]++;
                if(il[u]==graf[u].size()) deq.push_back({u,v.a,0});
            }
        }else{
            for(auto u:graf[v.b])
                if(!dp[u][v.a][1]) deq.push_back({u,v.a,1}),nxt[u][v.a]=v.b;
            if(!dp[v.b][v.a][1]) deq.push_back({v.b,v.a,1}),nxt[v.b][v.a]=v.b;
        }
    }
    for(int i=0;i<n;i++){
        bool ok=1;
        for(int k=0;k<n;k++) ok&=dp[i][k][1];
        if(ok){
            last=i;
            return i;
        }
    }
    return -1;
}

int nextMove(int R){
    return nxt[last][R];
}

Compilation message

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:42:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |                 if(il[u]==graf[u].size()) deq.push_back({u,v.a,0});
      |                    ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Incorrect 42 ms 2996 KB Cop can catch the robber, but start() returned -1
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 336 KB nextMove() returned a value that is either outside 0..N-1 or the new cop position is not a neighbour to the previous one
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Incorrect 0 ms 336 KB nextMove() returned a value that is either outside 0..N-1 or the new cop position is not a neighbour to the previous one
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Incorrect 42 ms 2996 KB Cop can catch the robber, but start() returned -1
5 Halted 0 ms 0 KB -