Submission #398940

# Submission time Handle Problem Language Result Execution time Memory
398940 2021-05-04T22:33:47 Z almothana05 Cop and Robber (BOI14_coprobber) C++14
0 / 100
47 ms 1808 KB
#include "coprobber.h"
#include<iostream>
#include<vector>
#include<algorithm>
 
using namespace std;
int menge = 0 , jet = 0 , r = 0;
	int cmp = 0 ;
bool done = 0;
vector<vector<int> >num ;
vector<vector<bool> >  a;
vector<int >vis(500+10 , 0), comp;
 
int start(int N, bool A[MAX_N][MAX_N])
{
	int re = 0 , erge = 0;
	for(int i =  0 ;i < N ; i++){
		re = 0;
		a.push_back(vector<bool>());
		num.push_back(vector<int>());
		for(int  j = 0 ; j < N  ; j++){
			a[i].push_back(A[i][j]);
			if(a[i][j] == 1){
				num[i].push_back(j);
				re++;
			}
		}
		if(re == 1){
			erge = i;
		}
	}
	menge = N;
	jet = erge;
    vis[erge] = 1;
    return erge;
}
 
int nextMove(int R)
{
    int now = 5000000 , pl;
    if(R == jet){
        return jet;
    }
    if(a[jet][R] == 1){
        jet = R;
        return jet;
    }
		for(int i =  0 ; i < menge ; i++){
			if(vis[i] < now && a[jet][i] == 1){
                now = vis[i];
				vis[i] ++;
				jet = i;
			}
		}
	return jet;
}

Compilation message

coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:40:25: warning: unused variable 'pl' [-Wunused-variable]
   40 |     int now = 5000000 , pl;
      |                         ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 47 ms 1808 KB Output is correct
5 Incorrect 12 ms 840 KB the situation repeated
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 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 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Incorrect 1 ms 200 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 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 47 ms 1808 KB Output is correct
5 Incorrect 12 ms 840 KB the situation repeated
6 Halted 0 ms 0 KB -