답안 #783447

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
783447 2023-07-15T00:07:54 Z boyliguanhan 장난감 기차 (IOI17_train) C++17
5 / 100
4 ms 856 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	std::vector<int> res(a.size(),0);
    res.back() = r.back();
    int x[r.size()];
    memset(x, 0, sizeof x);
    for(int i = 0; i < u.size(); i++) {
        x[u[i]]+=1<<v[i]-u[i];
    }
    for(int i = a.size()-1; i--;) {
        if(a[i]) {
            if(x[i]%2&&r[i]) res[i] = 1;
            else if(x[i]>1&&res[i+1]) res[i] = 1;
        } else {
            if(x[i]%2&&!r[i]) res[i] = 0;
            else if(x[i]>1&&!res[i+1])res[i] = 0;
            else res[i] = 1;
        }
    }
	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:9:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i = 0; i < u.size(); i++) {
      |                    ~~^~~~~~~~~~
train.cpp:10:25: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   10 |         x[u[i]]+=1<<v[i]-u[i];
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 596 KB Output is correct
2 Correct 2 ms 596 KB Output is correct
3 Correct 2 ms 568 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 3 ms 596 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 852 KB 3rd lines differ - on the 1226th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 724 KB 3rd lines differ - on the 151st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 856 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 596 KB Output is correct
2 Correct 2 ms 596 KB Output is correct
3 Correct 2 ms 568 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 3 ms 596 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
13 Halted 0 ms 0 KB -