Submission #425764

# Submission time Handle Problem Language Result Execution time Memory
425764 2021-06-13T11:10:46 Z MOUF_MAHMALAT Toy Train (IOI17_train) C++14
0 / 100
243 ms 1212 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
vector<vector<ll> >v;
ll n,id[5009];
bool b[5009],c[5009];
bool best(ll d,ll op)
{
    if(c[d])
        op=n;
    if(op==0)
        return 0;
    if(id[d]!=-1)
    {
        if(op==n)
            return 1;
        return best(id[d],op-1);
    }
    bool r=b[d]^1;

    for(auto z:v[d])
    {
        id[d]=z;
        if(b[d])
            r|=best(id[d],op-1);
        else
            r&=best(id[d],op-1);
    }
    return r;
}
vector<int> who_wins(vector<int> A, vector<int> R, vector<int> from, vector<int> to)
{
    n=A.size();
    v.resize(n);
    for(ll i=0; i<to.size(); i++)
        v[from[i]].push_back(to[i]);
    for(ll i=0; i<n; i++)
        b[i]=A[i],c[i]=R[i];
    vector<ll>ans;
    memset(id,-1,sizeof id);
    for(ll i=0; i<n; i++)
        ans.push_back(best(i,n));
    return ans;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:36:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(ll i=0; i<to.size(); i++)
      |                 ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1100 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 6th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 243 ms 1212 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1100 KB 3rd lines differ - on the 2856th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 154 ms 1156 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1100 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -