답안 #1052336

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1052336 2024-08-10T13:31:59 Z Unforgettablepl 장난감 기차 (IOI17_train) C++17
5 / 100
4 ms 992 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;

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<bool> presentself(n);
	vector<bool> presentnext(n);
	for(int i=0;i<m;i++) {
		if(v[i]==u[i])presentself[u[i]]=true;
		else presentnext[u[i]]=true;
	}
	vector<int> wins(n,-1);
	for(int i=0;i<n;i++){
		bool want_cycle = a[i]==r[i];
		bool get_cycle = !presentnext[i] or (want_cycle and presentself[i]);
		if(get_cycle) {
			if(want_cycle)wins[i]=a[i];
			else wins[i]=a[i]^1;
		}
	}
	for(int i=n-2;i>=0;i--)if(wins[i]==-1)wins[i]=wins[i+1];
	return wins;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 1 ms 724 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
# 결과 실행 시간 메모리 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 Incorrect 3 ms 860 KB 3rd lines differ - on the 1664th token, expected: '0', found: '-1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 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 992 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 1 ms 724 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
12 Incorrect 0 ms 348 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -