Submission #733516

# Submission time Handle Problem Language Result Execution time Memory
733516 2023-05-01T01:27:59 Z Trunkty Cop and Robber (BOI14_coprobber) C++14
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll

#include "coprobber.h"

bool isgood[505][505][2]; // 0 - robber, 1 - cop
int cnt[505][505];
vector<tuple<int,int,int>> v;

int start(int n, bool arr[MAX_N][MAX_N]){
    for(int i=0;i<n;i++){
        isgood[i][i][0] = true;
        isgood[i][i][1] = true;
        v.push_back(make_tuple(i,i,0));
        v.push_back(make_tuple(i,i,1));
        for(int j=0;j<n;j++){
            if(arr[i][j]){
                cnt[i][0]++;
            }
        }
        for(int j=1;j<n;j++){
            cnt[i][j] = cnt[i][j-1];
        }
    }
    for(int i=0;i<v.size();i++){
        int a = get<0>(v[i]), b = get<1>(v[i]), c = get<2>(v[i]);
        if(c==0){
            for(int j=0;j<n;j++){
                if(arr[b][j]){
                    if(!isgood[a][j][1]){
                        isgood[a][j][1] = true;
                        v.push_back(make_tuple(a,j,1));
                    }
                }
            }
            if(!isgood[a][b][1]){
                isgood[a][b][1] = true;
                v.push_back(make_tuple(a,b,1));
            }
        }
        else{
            for(int j=0;j<n;j++){
                if(arr[a][j]){
                    if(!isgood[j][b][0]){
                        cnt[j][b]--;
                        if(cnt[j][b]==0){
                            isgood[j][b][0] = true;
                            v.push_back(make_tuple(j,b,0));
                        }
                    }
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(!isgood[i][j][0] or !isgood[i][j][1]){
                return -1;
            }
        }
    }
    return 1;
}

int nextMove(int r){
    return -1;
}

Compilation message

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:27:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<int, int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int i=0;i<v.size();i++){
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 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 Incorrect 1 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 Incorrect 0 ms 208 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 Incorrect 0 ms 208 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 -