# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
283103 | 2020-08-25T10:01:10 Z | MKopchev | Toy Train (IOI17_train) | C++14 | 8 ms | 1280 KB |
#include "train.h" #include<bits/stdc++.h> using namespace std; const int nmax=42; int nxt[nmax]; vector<int> adj[nmax]; int n,owner[nmax],charge[nmax]; int rec(int node)//1-> A wins, 0-> B wins { if(nxt[node]!=-1) { if(charge[node])return 1; int other=nxt[node]; while(other!=node) { if(charge[other])return 1; other=nxt[other]; } return 0; } for(auto k:adj[node]) { nxt[node]=k; int mem=rec(k); nxt[node]=-1; if(mem==owner[node])return mem; } return !owner[node]; } std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { memset(nxt,-1,sizeof(nxt)); n=a.size(); for(int i=0;i<a.size();i++)owner[i]=a[i]; for(int i=0;i<r.size();i++)charge[i]=r[i]; for(int i=0;i<u.size();i++) adj[u[i]].push_back(v[i]); vector<int> ret={}; for(int i=0;i<a.size();i++) ret.push_back(rec(i)); return ret; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 896 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 256 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 0 ms | 256 KB | Output is correct |
15 | Correct | 1 ms | 256 KB | Output is correct |
16 | Correct | 0 ms | 256 KB | Output is correct |
17 | Correct | 1 ms | 256 KB | Output is correct |
18 | Correct | 1 ms | 256 KB | Output is correct |
19 | Correct | 0 ms | 256 KB | Output is correct |
20 | Correct | 0 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 1280 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 1024 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 8 ms | 1280 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 896 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |