Submission #356654

#TimeUsernameProblemLanguageResultExecution timeMemory
356654urd05Scales (IOI15_scales)C++14
0 / 100
1 ms632 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } int g(int a,int b) { for(int i=1;i<=6;i++) { if (i!=a&&i!=b) { return i; } } } int get(vector<int> v) { if (v.size()==1) { return v[0]; } if (v.size()==2) { return getLightest(v[0],v[1],g(v[0],v[1])); } int val=v[0]; for(int i=1;i<v.size();i+=2) { if (i+1==v.size()) { val=getLightest(val,v[i],g(val,v[i])); } val=getLightest(val,v[i],v[i+1]); } return val; } void orderCoins() { int W[6]; vector<int> v; for(int i=1;i<=6;i++) { v.push_back(i); } for(int i=0;i<6;i++) { vector<int> nt; W[i]=get(v); for(int j=0;j<v.size();j++) { if (v[j]!=W[i]) { nt.push_back(v[j]); } } v=nt; } answer(W); return; }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
    5 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'int get(std::vector<int>)':
scales.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i=1;i<v.size();i+=2) {
      |                 ~^~~~~~~~~
scales.cpp:26:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         if (i+1==v.size()) {
      |             ~~~^~~~~~~~~~
scales.cpp: In function 'void orderCoins()':
scales.cpp:43:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         for(int j=0;j<v.size();j++) {
      |                     ~^~~~~~~~~
scales.cpp: In function 'int g(int, int)':
scales.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
   15 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...