제출 #128017

#제출 시각아이디문제언어결과실행 시간메모리
128017MoNsTeR_CuBe저울 (IOI15_scales)C++17
컴파일 에러
0 ms0 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { #define int long long #undef int } void orderCoins() { #define int long long int W[] = {1, 2, 3, 4, 5, 6}; vector< int > left; vector< int > right; left.push_back(getLightest(W[0], W[1], W[2])); left.push_back(getMedian(W[0], W[1], W[2])); for(int i = 0; i < 3; i++){ bool verif = false; for(int j = 0; j < 2; j++){ if(left[j] == W[i]) verif = true; } if(!verif) left.push_back(W[i]); } right.push_back(getLightest(W[3], W[4], W[5])); right.push_back(getMedian(W[3], W[4], W[5])); for(int i = 3; i < 6; i++){ bool verif = false; for(int j = 0; j < 2; j++){ if(right[j] == W[i]) verif = true; } if(!verif) right.push_back(W[i]); } int rem = 6; vector< int > ans; while(rem > 3){ if((int)left.size() >= 2){ ans.push_back(getHeaviest(left.back(), left[left.size()-2], right.back())); if(ans.back() == right.back()) right.pop_back(); if(ans.back() == left.back()) left.pop_back(); }else{ ans.push_back(getHeaviest(left.back(), right[right.size()-2], right.back())); if(ans.back() == right.back()) right.pop_back(); if(ans.back() == left.back()) left.pop_back(); } rem--; } vector< int > remaining; while(!left.empty()){ remaining.push_back(left.back()); left.pop_back(); } while(!right.empty()){ remaining.push_back(right.back()); right.pop_back(); } ans.push_back(getHeaviest(remaining[0], remaining[1], remaining[2])); ans.push_back(getMedian(remaining[0], remaining[1], remaining[2])); ans.push_back(getLightest(remaining[0], remaining[1], remaining[2])); for(int i = 0; i < 6; i++){ W[i] = ans[i]; } answer(W); #undef int }

컴파일 시 표준 에러 (stderr) 메시지

scales.cpp: In function 'void init(int)':
scales.cpp:8:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:21:35: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     left.push_back(getLightest(W[0], W[1], W[2]));
                                ~~~^
scales.cpp:21:41: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     left.push_back(getLightest(W[0], W[1], W[2]));
                                      ~~~^
scales.cpp:21:47: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     left.push_back(getLightest(W[0], W[1], W[2]));
                                            ~~~^
scales.cpp:22:33: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     left.push_back(getMedian(W[0], W[1], W[2]));
                              ~~~^
scales.cpp:22:39: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     left.push_back(getMedian(W[0], W[1], W[2]));
                                    ~~~^
scales.cpp:22:45: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     left.push_back(getMedian(W[0], W[1], W[2]));
                                          ~~~^
scales.cpp:31:33: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  right.push_back(getLightest(W[3], W[4], W[5]));
                              ~~~^
scales.cpp:31:39: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  right.push_back(getLightest(W[3], W[4], W[5]));
                                    ~~~^
scales.cpp:31:45: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  right.push_back(getLightest(W[3], W[4], W[5]));
                                          ~~~^
scales.cpp:32:31: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  right.push_back(getMedian(W[3], W[4], W[5]));
                            ~~~^
scales.cpp:32:37: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  right.push_back(getMedian(W[3], W[4], W[5]));
                                  ~~~^
scales.cpp:32:43: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  right.push_back(getMedian(W[3], W[4], W[5]));
                                        ~~~^
scales.cpp:48:39: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
    ans.push_back(getHeaviest(left.back(), left[left.size()-2], right.back()));
                              ~~~~~~~~~^~
scales.cpp:48:76: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
    ans.push_back(getHeaviest(left.back(), left[left.size()-2], right.back()));
                                                                            ^
scales.cpp:48:74: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
    ans.push_back(getHeaviest(left.back(), left[left.size()-2], right.back()));
                                                                ~~~~~~~~~~^~
scales.cpp:52:39: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
    ans.push_back(getHeaviest(left.back(), right[right.size()-2], right.back()));
                              ~~~~~~~~~^~
scales.cpp:52:78: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
    ans.push_back(getHeaviest(left.back(), right[right.size()-2], right.back()));
                                                                              ^
scales.cpp:52:76: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
    ans.push_back(getHeaviest(left.back(), right[right.size()-2], right.back()));
                                                                  ~~~~~~~~~~^~
scales.cpp:69:68: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
  ans.push_back(getHeaviest(remaining[0], remaining[1], remaining[2]));
                                                                    ^
scales.cpp:69:68: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
scales.cpp:69:68: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
scales.cpp:70:66: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
  ans.push_back(getMedian(remaining[0], remaining[1], remaining[2]));
                                                                  ^
scales.cpp:70:66: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
scales.cpp:70:66: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
scales.cpp:71:68: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
  ans.push_back(getLightest(remaining[0], remaining[1], remaining[2]));
                                                                    ^
scales.cpp:71:68: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
scales.cpp:71:68: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
scales.cpp:75:13: error: cannot convert 'long long int*' to 'int*' for argument '1' to 'void answer(int*)'
     answer(W);
             ^