답안 #434506

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
434506 2021-06-21T11:20:14 Z medmdg 장난감 기차 (IOI17_train) C++14
0 / 100
8 ms 736 KB
#include<bits/stdc++.h>
#include "train.h"
#define ll  int
using namespace std;
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
        vector<ll> win;
        bool h[a.size()]={false};
        for(int i=0;i<u.size();i++){
            if(u[i]==v[i])
                h[u[i]]=true;
        }
        for(int i=0;i<a.size();i++){
            if(h[i]){
                if(r[i]*a[i]){
                        while(win.size()<i)
                            win.push_back(1);
                }
                if(!(a[i]+r[i])){
                    while(win.size()<i)
                        win.push_back(0);
                }
            }
        }
        while(win.size()<a.size()){
            win.push_back(1-a[a.size()-1]);
        }
        return win;
}


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:8:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |         for(int i=0;i<u.size();i++){
      |                     ~^~~~~~~~~
train.cpp:12:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |         for(int i=0;i<a.size();i++){
      |                     ~^~~~~~~~~
train.cpp:14:24: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
   14 |                 if(r[i]*a[i]){
train.cpp:15:41: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   15 |                         while(win.size()<i)
      |                               ~~~~~~~~~~^~
train.cpp:19:37: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |                     while(win.size()<i)
      |                           ~~~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 460 KB 3rd lines differ - on the 13th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 716 KB Output is correct
2 Correct 6 ms 716 KB Output is correct
3 Correct 6 ms 716 KB Output is correct
4 Incorrect 7 ms 736 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 588 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 716 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 460 KB 3rd lines differ - on the 13th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -