답안 #425736

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
425736 2021-06-13T10:43:51 Z MOUF_MAHMALAT 장난감 기차 (IOI17_train) C++14
5 / 100
269 ms 262148 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];
bool best(ll d)
{
    bool r=b[d]^1;
    for(auto z:v[d])
    {
        if(z==d)
        {
            if(c[d]==b[d])
            r=b[d];
        }
        else
        {
            if(b[d])
                r|=best(z);
            else
                r&=best(z);
        }
    }
    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;
    for(ll i=0; i<n; i++)
        ans.push_back(best(i));
    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:32:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(ll i=0; i<to.size(); i++)
      |                 ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 269 ms 1080 KB Output is correct
2 Correct 93 ms 916 KB Output is correct
3 Correct 42 ms 844 KB Output is correct
4 Correct 15 ms 844 KB Output is correct
5 Correct 8 ms 832 KB Output is correct
6 Correct 5 ms 716 KB Output is correct
7 Correct 5 ms 716 KB Output is correct
8 Correct 5 ms 708 KB Output is correct
9 Correct 5 ms 716 KB Output is correct
10 Correct 4 ms 716 KB Output is correct
11 Correct 4 ms 716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 168 ms 262148 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 211 ms 262148 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 170 ms 262148 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 203 ms 262148 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 269 ms 1080 KB Output is correct
2 Correct 93 ms 916 KB Output is correct
3 Correct 42 ms 844 KB Output is correct
4 Correct 15 ms 844 KB Output is correct
5 Correct 8 ms 832 KB Output is correct
6 Correct 5 ms 716 KB Output is correct
7 Correct 5 ms 716 KB Output is correct
8 Correct 5 ms 708 KB Output is correct
9 Correct 5 ms 716 KB Output is correct
10 Correct 4 ms 716 KB Output is correct
11 Correct 4 ms 716 KB Output is correct
12 Runtime error 168 ms 262148 KB Execution killed with signal 9
13 Halted 0 ms 0 KB -