제출 #977278

#제출 시각아이디문제언어결과실행 시간메모리
977278IUA_Hasin저울 (IOI15_scales)C++17
45.45 / 100
1 ms348 KiB
#include "scales.h" #include <bits/stdc++.h> #define endl "\n" #define ll long long int t; int vis[7]; void init(int T) { t = T; } void orderCoins() { for(int i=0; i<7; i++){ vis[i] = 0; } int w[6]; int a = getHeaviest(1, 2, 3); int b = getHeaviest(4, 5, 6); int c; if(a==1){ c = getHeaviest(a, b, 2); } else { c = getHeaviest(a, b, 1); } w[5] = c; vis[c] = 1; int a1; if(c==a){ if(a==1){ a1 = getHeaviest(b, 2, 3); } else if(a==2){ a1 = getHeaviest(b, 1, 3); } else { a1 = getHeaviest(b, 1, 2); } } else { if(b==4){ a1 = getHeaviest(a, 5, 6); } else if(b==5){ a1 = getHeaviest(a, 4, 6); } else { a1 = getHeaviest(a, 4, 5); } } w[4] = a1; vis[a1] = 1; std::vector<ll> v; for(int i=1; i<=6; i++){ if(vis[i]==0){ v.push_back(i); } } int a2 = getHeaviest(v[0], v[1], v[2]); int a3; if(a2==v[0]){ a3 = getHeaviest(a2, v[1], v[3]); } else { a3 = getHeaviest(a2, v[0], v[3]); } w[3] = a3; vis[a3] = 1; std::vector<ll> v2; for(int i=1; i<=6; i++){ if(vis[i]==0){ v2.push_back(i); } } int a4 = getHeaviest(v2[0], v2[1], v2[2]); int a5 = getLightest(v2[0], v2[1], v2[2]); int a6 = getMedian(v2[0], v2[1], v2[2]); w[2] = a4; w[1] = a6; w[0] = a5; answer(w); }

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

scales.cpp: In function 'void orderCoins()':
scales.cpp:60:42: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   60 |     int a2 = getHeaviest(v[0], v[1], v[2]);
      |                                          ^
scales.cpp:60:42: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:60:42: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:63:40: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   63 |         a3 = getHeaviest(a2, v[1], v[3]);
      |                                        ^
scales.cpp:63:40: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:65:40: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   65 |         a3 = getHeaviest(a2, v[0], v[3]);
      |                                        ^
scales.cpp:65:40: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:78:45: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   78 |     int a4 = getHeaviest(v2[0], v2[1], v2[2]);
      |                                             ^
scales.cpp:78:45: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:78:45: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:79:45: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   79 |     int a5 = getLightest(v2[0], v2[1], v2[2]);
      |                                             ^
scales.cpp:79:45: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:79:45: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:80:43: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   80 |     int a6 = getMedian(v2[0], v2[1], v2[2]);
      |                                           ^
scales.cpp:80:43: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:80:43: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
#Verdict Execution timeMemoryGrader output
Fetching results...