# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
283320 | 2020-08-25T14:22:57 Z | davi_bart | 장난감 기차 (IOI17_train) | C++14 | 2000 ms | 1408 KB |
#include <bits/stdc++.h> #include "train.h" using namespace std; #define ll long long //#define int ll mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); bool pers[6000]; set<int> charge; vector<int> p[6000]; vector<int> tempo(5010,0); int temp=1; int dfs(int pos,int last_charge){//return 0 if cycle without charger if(tempo[pos]>0){ if(tempo[pos]>last_charge)return 0; return 1; } tempo[pos]=temp; if(charge.find(pos)!=charge.end())last_charge=temp; temp++; if(pers[pos]==0){ int sol=1; for(int x:p[pos]){ temp=tempo[pos]+1; sol=min(sol,dfs(x,last_charge)); } tempo[pos]=0; return sol; }else{ int sol=0; for(int x:p[pos]){ temp=tempo[pos]+1; sol=max(sol,dfs(x,last_charge)); } tempo[pos]=0; return sol; } } std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { for(int i=0;i<a.size();i++)if(a[i])pers[i]=1; for(int i=0;i<r.size();i++)if(r[i])charge.insert(i); vector<int> ans(a.size(),0); for(int i=0;i<u.size();i++)p[u[i]].push_back(v[i]); for(int i=0;i<a.size();i++){ temp=1; fill(tempo.begin(),tempo.end(),0); ans[i]=dfs(i,-2); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 833 ms | 1400 KB | Output is correct |
2 | Correct | 274 ms | 1152 KB | Output is correct |
3 | Correct | 130 ms | 1144 KB | Output is correct |
4 | Correct | 45 ms | 1024 KB | Output is correct |
5 | Correct | 34 ms | 1024 KB | Output is correct |
6 | Correct | 21 ms | 1152 KB | Output is correct |
7 | Correct | 20 ms | 1024 KB | Output is correct |
8 | Correct | 20 ms | 1024 KB | Output is correct |
9 | Correct | 18 ms | 1024 KB | Output is correct |
10 | Correct | 18 ms | 1024 KB | Output is correct |
11 | Correct | 17 ms | 1024 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 512 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 128 ms | 512 KB | Output is correct |
5 | Correct | 1 ms | 512 KB | Output is correct |
6 | Correct | 1 ms | 512 KB | Output is correct |
7 | Correct | 1 ms | 512 KB | Output is correct |
8 | Correct | 4 ms | 512 KB | Output is correct |
9 | Correct | 45 ms | 512 KB | Output is correct |
10 | Correct | 1 ms | 512 KB | Output is correct |
11 | Correct | 26 ms | 512 KB | Output is correct |
12 | Correct | 1 ms | 512 KB | Output is correct |
13 | Correct | 1 ms | 512 KB | Output is correct |
14 | Correct | 1 ms | 512 KB | Output is correct |
15 | Correct | 1 ms | 512 KB | Output is correct |
16 | Correct | 1 ms | 512 KB | Output is correct |
17 | Correct | 1 ms | 512 KB | Output is correct |
18 | Correct | 1 ms | 512 KB | Output is correct |
19 | Correct | 1 ms | 512 KB | Output is correct |
20 | Correct | 1 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2070 ms | 1408 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2081 ms | 1408 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2075 ms | 1408 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 833 ms | 1400 KB | Output is correct |
2 | Correct | 274 ms | 1152 KB | Output is correct |
3 | Correct | 130 ms | 1144 KB | Output is correct |
4 | Correct | 45 ms | 1024 KB | Output is correct |
5 | Correct | 34 ms | 1024 KB | Output is correct |
6 | Correct | 21 ms | 1152 KB | Output is correct |
7 | Correct | 20 ms | 1024 KB | Output is correct |
8 | Correct | 20 ms | 1024 KB | Output is correct |
9 | Correct | 18 ms | 1024 KB | Output is correct |
10 | Correct | 18 ms | 1024 KB | Output is correct |
11 | Correct | 17 ms | 1024 KB | Output is correct |
12 | Correct | 1 ms | 512 KB | Output is correct |
13 | Correct | 1 ms | 512 KB | Output is correct |
14 | Correct | 1 ms | 512 KB | Output is correct |
15 | Correct | 128 ms | 512 KB | Output is correct |
16 | Correct | 1 ms | 512 KB | Output is correct |
17 | Correct | 1 ms | 512 KB | Output is correct |
18 | Correct | 1 ms | 512 KB | Output is correct |
19 | Correct | 4 ms | 512 KB | Output is correct |
20 | Correct | 45 ms | 512 KB | Output is correct |
21 | Correct | 1 ms | 512 KB | Output is correct |
22 | Correct | 26 ms | 512 KB | Output is correct |
23 | Correct | 1 ms | 512 KB | Output is correct |
24 | Correct | 1 ms | 512 KB | Output is correct |
25 | Correct | 1 ms | 512 KB | Output is correct |
26 | Correct | 1 ms | 512 KB | Output is correct |
27 | Correct | 1 ms | 512 KB | Output is correct |
28 | Correct | 1 ms | 512 KB | Output is correct |
29 | Correct | 1 ms | 512 KB | Output is correct |
30 | Correct | 1 ms | 512 KB | Output is correct |
31 | Correct | 1 ms | 512 KB | Output is correct |
32 | Execution timed out | 2070 ms | 1408 KB | Time limit exceeded |
33 | Halted | 0 ms | 0 KB | - |