Submission #484305

# Submission time Handle Problem Language Result Execution time Memory
484305 2021-11-02T23:05:08 Z MohamedFaresNebili Cop and Robber (BOI14_coprobber) C++14
0 / 100
1 ms 328 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include "coprobber.h"
 
        using namespace std;
        using namespace __gnu_pbds;
 
        using ll  = long long;
        using ld  = long double;
        using ii  = pair<ll, ll>;
        using ull = unsigned long long;
 
        using vl  = vector<long long>;
 
        #define mp make_pair
        #define pb push_back
        #define pp pop_back
        #define ff first
        #define ss second
        #define lb lower_bound
        #define ub upper_bound
        #define all(x) (x).begin() , (x).end()
        #define vi vector<int>
 
        const int N = 2*100005;
        const long long MOD = 1000000007;
        const long double EPS = 0.000000001;
        const double PI = 3.14159265358979323846;
        const long long INF = 10000000000000000;
        const int nx[2]={1, 0}, ny[2]={0, 1};
 
        long long gcd(int a, int b) { return (b==0?a:gcd(b, a%b)); }
        long long lcm(int a, int b) { return  a*(b/gcd(a, b)); }
        long long fact(int a) { return (a==1?1:a*fact(a-1)); }
 
        template<class T> using Tree = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
 
        #define MAX_N 500
        vector<int>adj[MAX_N];
 
        int police = 0;
 
        int start(int N, bool A[MAX_N][MAX_N])
        {
            for(int l = 0; l < N; l++) {
                for(int i=0; i < N; i++) {
                    if(A[l][i]) adj[l].pb(i);
                }
            }
            return 0;
        }
 
        int nextMove(int R)
        {
            int r1 = police / 4, r2 = R / 4;
            int c1 = police % 4, c2 = R % 4;
            int b = abs(c1 - c2), a = abs(r1 - r2);
            if(a < b) return police=c1+1+r1;
            else if(a > b) return police=(c1+1)*4+r1;
            else return police;
        }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Incorrect 0 ms 328 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
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 0 ms 200 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Incorrect 1 ms 328 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
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Incorrect 0 ms 328 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
4 Halted 0 ms 0 KB -