답안 #429289

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
429289 2021-06-15T20:04:16 Z Dremix10 장난감 기차 (IOI17_train) C++17
0 / 100
7 ms 1484 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#ifdef dremix
    #define p(x) cerr<<#x<<" = "<<x<<endl;
    #define p2(x,y) cerr<<#x<<", "<<#y<<" = {"<<x<<", "<<y<<"}"<<endl;
    #define pp(x) cerr<<#x<<" = "<<"("<<x.F<<" - "<<x.S<<")"<<endl;
    #define pv(x) cerr<<#x<<" = "<<"{";for(auto y : x)cerr<<y<<", ";cerr<<"}"<<endl;
    #define ppv(x) cerr<<#x<<" = "<<"{";for(auto y : x)cerr<<y.F<<"-"<<y.S<<", ";cerr<<"}"<<endl;
#else
    #define p(x)
    #define p2(x,y)
    #define pp(x)
    #define pv(x)
    #define ppv(x)
#endif
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int maxp = 22;
const ld EPS = 1e-9;
const ll INF = 1e18;
const int MOD = 1e9+7;
const int N = 15;

vector<vector<int> > adj(N);

bool vv[N];
vector<int> aa,rr;

bool solve(int s, bool power){
    p2(s,power)
    p(vv[s])
    if(vv[s])return power;
    power |= rr[s];
    p2(s,power)
    vv[s] = true;
    if(aa[s]){
        bool ans = false;
        for(auto x : adj[s])
            ans |= solve(x,power);
        p2(s,ans)
        return ans;
    }
    bool ans = true;
    for(auto x : adj[s])
        ans &= solve(x,power);
    p2(s,ans)
    return ans;
}

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
    int n = a.size();
    int m = u.size();
    aa = a;
    rr = r;

    int i,j;


    for(i=0;i<m;i++){
        int x = u[i];
        int y = v[i];

        adj[x].push_back(y);
    }

    vector<int> ans(n);

    for(i=0;i<n;i++){
        for(j=0;j<n;j++)vv[j] = false;
        ans[i] = solve(i,false);
        p2(i,ans[i])
    }

    return ans;

/*

g++ grader.cpp trainSub.cpp -Ddremix

*/

}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 844 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1484 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 1228 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1484 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 844 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -