# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
33537 | 2017-10-29T16:29:00 Z | mohammad_kilani | 장난감 기차 (IOI17_train) | C++14 | 2000 ms | 262144 KB |
#include <bits/stdc++.h> #include "train.h" using namespace std; const int N = 5010; int n ; int dp[N][N]; vector<int> a, r; vector<int> g[N]; bool solve(int i,int j){ if(r[i]) j = n; if(j == 0) return 0; if(dp[i][j] != -1) return dp[i][j]; dp[i][j] = 1; if(r[i]){ for(int k=0;k<g[i].size();k++){ int node = g[i][k]; if(solve(node,j-1) == 0) dp[i][j] = 0; } } else{ bool can = false; for(int k=0;k<g[i].size();k++){ int node = g[i][k]; if(solve(node,j-1) == 1) can = true; } dp[i][j] = can; } return dp[i][j]; } std::vector<int> who_wins(std::vector<int> A, std::vector<int> R, std::vector<int> u, std::vector<int> v) { vector<int> ans; a = A; r = R;; n = a.size(); for(int i=0;i<u.size();i++) g[u[i]].push_back(v[i]); memset(dp,-1,sizeof(dp)); for(int i=0;i<n;i++) ans.push_back(solve(i,n)); return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 136 ms | 245292 KB | 3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 100184 KB | 3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 659 ms | 101416 KB | Output is correct |
2 | Correct | 386 ms | 101376 KB | Output is correct |
3 | Correct | 353 ms | 101380 KB | Output is correct |
4 | Memory limit exceeded | 169 ms | 262144 KB | Memory limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 101064 KB | 3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2000 ms | 101072 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 136 ms | 245292 KB | 3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |