답안 #416661

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
416661 2021-06-02T17:55:34 Z yanire 장난감 기차 (IOI17_train) C++11
5 / 100
2000 ms 1404 KB
#include <bits/stdc++.h>
using namespace std;
#include "train.h"
#define fin(i,s,n) for(auto i = s; i < n; ++i)
#define fine(i,s,n) for(auto i = s; i <= n; ++i)
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define all(x) (x).begin(),(x).end()
#define chkmin(a,b) a = min(a,b)
#define chkmax(a,b) a = max(a,b)
using stdvec = vector<int>;
using ii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vii = vector<ii>;
#define sz(a) int((a).size())
const int maxn = 5005;
vi g[maxn];
bool vis[maxn];
int c[maxn],p[maxn];
int loc[maxn];
bool dfs(int u, int l = 0,int lstC = -1) {
    if(loc[u]!=-1) return loc[u] <= lstC;
    loc[u] = l++;
    if(c[u]) lstC = loc[u];
    for(int v : g[u]) {
        bool RES = dfs(v,l,lstC);
        if(RES&&p[u]) return 1;
        if(!(RES||p[u])) return 0;
    }
    loc[u] = -1;
    return !p[u];
}
vi who_wins(vi a, vi r, vi u, vi v) {
    int n = a.size(),m = u.size();
    vi lp(n,0),nxt(n,0);
    fin(i,0,m) {
        g[u[i]].pb(v[i]);
    }
    fin(i,0,n) p[i]=a[i],c[i]=r[i];
    vi res(n);
    fin(i,0,n) {
        fin(j,0,n) loc[j] = -1;
        res[i] = dfs(i);
    }
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 844 KB Output is correct
2 Correct 25 ms 844 KB Output is correct
3 Correct 25 ms 844 KB Output is correct
4 Correct 24 ms 952 KB Output is correct
5 Correct 23 ms 956 KB Output is correct
6 Correct 23 ms 844 KB Output is correct
7 Correct 17 ms 848 KB Output is correct
8 Correct 17 ms 1032 KB Output is correct
9 Correct 23 ms 844 KB Output is correct
10 Correct 25 ms 836 KB Output is correct
11 Correct 16 ms 844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2031 ms 1404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2050 ms 1316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 749 ms 1376 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 844 KB Output is correct
2 Correct 25 ms 844 KB Output is correct
3 Correct 25 ms 844 KB Output is correct
4 Correct 24 ms 952 KB Output is correct
5 Correct 23 ms 956 KB Output is correct
6 Correct 23 ms 844 KB Output is correct
7 Correct 17 ms 848 KB Output is correct
8 Correct 17 ms 1032 KB Output is correct
9 Correct 23 ms 844 KB Output is correct
10 Correct 25 ms 836 KB Output is correct
11 Correct 16 ms 844 KB Output is correct
12 Incorrect 1 ms 332 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -