Submission #733517

#TimeUsernameProblemLanguageResultExecution timeMemory
733517TrunktyCop and Robber (BOI14_coprobber)C++14
100 / 100
418 ms10292 KiB
#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],pre[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]){ pre[a][j] = b; isgood[a][j][1] = true; v.push_back(make_tuple(a,j,1)); } } } if(!isgood[a][b][1]){ pre[a][b] = b; 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 curr=1; int nextMove(int r){ int a = pre[r][curr]; curr = a; return a; }

Compilation message (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...