답안 #617911

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
617911 2022-08-01T17:02:54 Z Ozy 장난감 기차 (IOI17_train) C++17
0 / 100
8 ms 1364 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "

#define MAX 5000

lli n,m;
vector<lli> hijos[MAX];

std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {

	m = u.size();
	rep(i,0,m-1) hijos[u[i]].push_back(v[i]);

	n = a.size();
	vector<int> res;
	res.resize(n);
	rep(i,0,n-1) res[i] = a[i]^1;

	repa(i,n-1,0) {
        if (a[i] == 1) {
            for (auto h : hijos[i]) {
                if (h == i && r[i] == 1) res[i] = 1;
                else if (res[h] == 1) res[i] == 1;
            }
        }
        else {
            for (auto h : hijos[i]) {
                if (h == i && r[i] == 0) res[i] = 0;
                else if (res[h] == 0) res[i] == 0;
            }
        }
	}

	return res;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:29:46: warning: value computed is not used [-Wunused-value]
   29 |                 else if (res[h] == 1) res[i] == 1;
train.cpp:35:46: warning: value computed is not used [-Wunused-value]
   35 |                 else if (res[h] == 0) res[i] == 0;
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 824 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 420 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1364 KB Output is correct
2 Correct 7 ms 1236 KB Output is correct
3 Correct 6 ms 1236 KB Output is correct
4 Incorrect 6 ms 1328 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1064 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1364 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 824 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -