답안 #1074343

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1074343 2024-08-25T09:55:37 Z zehnsechs 장난감 기차 (IOI17_train) C++14
0 / 100
5 ms 860 KB
#include "train.h"
#include<bits/stdc++.h>

using namespace std;


void dfs(int v, vector<int>& x, vector<int>& c, vector<vector<int>>& adj, vector<int>& res){
    if (x[v]) res[v]=1;
    cerr << "vertex " << v << '\n';    
    if(res[v]){
        for(int u: adj[v]){
            cerr << "n " << u << '\n';
            if (u==v) continue;
            c[u]--;
            if(c[u]==0 && !res[u]) {
                res[u]=1;
                dfs(u,x,c,adj,res);
            }
        }
    }
}


vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	int n = a.size();
        int m = u.size();
        vector<int> res(n,1);
        vector<int> loop(n,0);
        for(int i=0;i<m;++i){
            if(u[i]==v[i]) loop[u[i]]=1;
        }
        
        res[n-1] = r[n-1];
        for(int i = n-2; i>=0; --i){
		if(a[i] && loop[i]) res[i] = res[i+1] || r[i];
		else if(loop[i]) res[i] = res[i+1] && r[i];
		else res[i] = res[i+1];       
        }

	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Incorrect 2 ms 604 KB 3rd lines differ - on the 355th token, expected: '1', found: '0'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 860 KB Output is correct
2 Correct 3 ms 860 KB Output is correct
3 Correct 3 ms 860 KB Output is correct
4 Incorrect 4 ms 856 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 860 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 860 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Incorrect 2 ms 604 KB 3rd lines differ - on the 355th token, expected: '1', found: '0'
4 Halted 0 ms 0 KB -