답안 #434513

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
434513 2021-06-21T11:29:36 Z medmdg 장난감 기차 (IOI17_train) C++14
0 / 100
9 ms 1160 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};
        bool k[a.size()]={false};
        for(int i=0;i<u.size();i++){
            if(u[i]==v[i])
                h[u[i]]=true;
            if(v[i]==u[i]+1)
                k[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);
                }
            }
            if(!k[i]){
                while(win.size()<i)
                        win.push_back(1-a[i]);
            }
        }
        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: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:15:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |         for(int i=0;i<a.size();i++){
      |                     ~^~~~~~~~~
train.cpp:17:24: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
   17 |                 if(r[i]*a[i]){
train.cpp:18:41: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |                         while(win.size()<i)
      |                               ~~~~~~~~~~^~
train.cpp:22:37: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |                     while(win.size()<i)
      |                           ~~~~~~~~~~^~
train.cpp:27:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |                 while(win.size()<i)
      |                       ~~~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 460 KB WA in grader: Wrong returned array size
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB WA in grader: Wrong returned array size
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 1160 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 972 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 696 KB WA in grader: Wrong returned array size
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 460 KB WA in grader: Wrong returned array size
2 Halted 0 ms 0 KB -