Submission #425708

# Submission time Handle Problem Language Result Execution time Memory
425708 2021-06-13T10:23:51 Z MOUF_MAHMALAT Toy Train (IOI17_train) C++14
0 / 100
9 ms 1868 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
vector<vector<ll> >v;
ll n;
bool b[5009],c[5009];
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;
    for(ll i=n-1; i>=0; i--)
    {
        bool is=0;
        for(auto z:v[i])
            if(z==i)
                is=1;
        if((is&&c[i]&&b[i])||(is&&c[i]&&v[i].size()==1))
            ans.push_back(1);
        else
        ans.push_back(ans.back());
    }
    reverse(ans.begin(),ans.end());
    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:12:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(ll i=0; i<to.size(); i++)
      |                 ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 1356 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 1836 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 1528 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 1868 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 1356 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -