답안 #416564

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
416564 2021-06-02T15:55:36 Z yanire 장난감 기차 (IOI17_train) C++11
0 / 100
1137 ms 1516 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];
int vis[maxn];
bool p[maxn], c[maxn];
void dfs(int u) {
    if(vis[u]) return;
    if(c[u]) { vis[u] = 1; return; }
    vis[u] = -2;
    for(int v : g[u]) if(!vis[v]) dfs(v);
    if(p[u]==1) {
        vis[u] = -1;
        for(int v : g[u]) if(vis[v]==1) { vis[u] = 1; return; }
    } else {
        vis[u] = 1;
        for(int v : g[u]) if(vis[v]==-1) {vis[v] = -1; return; }
    }
}
vi who_wins(vi a, vi r, vi u, vi v) {
    int n = a.size(),m = u.size();
    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) {
        memset(vis,0,sizeof vis);
        dfs(i);
        res[i] = vis[i]>0;
    }
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 844 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 101 ms 1496 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 1224 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1137 ms 1516 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 844 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -