Submission #619847

#TimeUsernameProblemLanguageResultExecution timeMemory
619847aminScales (IOI15_scales)C++14
55.56 / 100
1 ms212 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } void orderCoins() { /* ... */ int W[] = {1, 2, 3, 4, 5, 6}; long o=getLightest(1,2,3); long oo=getLightest(4,5,6); swap(W[0],W[o-1]); swap(W[3],W[oo-1]); vector<long>ans; o=getLightest(W[0],W[1],W[3]); vector<long>v; ans.push_back(o); if(W[3]==o) { swap(W[0],W[3]); swap(W[1],W[4]); swap(W[2],W[5]); } long k=getLightest(W[1],W[2],W[3]); ans.push_back(k); for(long i=0;i<6;i++) { if(W[i]!=k&&W[i]!=o) { v.push_back(W[i]); } } long x=getLightest(v[0],v[1],getMedian(v[2],v[3],ans[0])); for(long i=0;i<4;i++) { if(v[i]==x) { v.erase(v.begin()+i); } } ans.push_back(x); o=getLightest(v[0],v[1],v[2]); oo=getMedian(v[0],v[1],v[2]); ans.push_back(o); ans.push_back(oo); for(long i=0;i<3;i++) { if(v[i]!=o&&v[i]!=oo) { ans.push_back(v[i]); break; } } for(long i=0;i<6;i++) { W[i]=ans[i]; } answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
    4 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:34:60: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   34 |     long x=getLightest(v[0],v[1],getMedian(v[2],v[3],ans[0]));
      |                                                            ^
scales.cpp:34:60: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:34:60: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:34:61: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   34 |     long x=getLightest(v[0],v[1],getMedian(v[2],v[3],ans[0]));
      |                                                             ^
scales.cpp:34:61: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:43:33: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   43 |     o=getLightest(v[0],v[1],v[2]);
      |                                 ^
scales.cpp:43:33: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:43:33: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:44:32: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   44 |     oo=getMedian(v[0],v[1],v[2]);
      |                                ^
scales.cpp:44:32: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:44:32: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:58:19: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   58 |         W[i]=ans[i];
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...