Submission #290824

#TimeUsernameProblemLanguageResultExecution timeMemory
290824kshitij_sodaniScales (IOI15_scales)C++14
55.73 / 100
1 ms384 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; #define a first #define b second #define pb push_back void init(int T) { /* ... */ } void orderCoins() { /* ... */ vector<int> cur; int aa=1; int bb=2; int cc=3; cur.pb(getLightest(aa,bb,cc)); cur.pb(getMedian(aa,bb,cc)); for(int i=1;i<=3;i++){ if(i!=cur[0] and i!=cur[1]){ cur.pb(i); } } for(int i=4;i<=6;i++){ vector<pair<int,int>> ss; if(i==4){ ss.pb({0,1}); ss.pb({1,2}); } else if(i==5){ ss.pb({0,1}); ss.pb({2,3}); } else{ int xx=getMedian(cur[1],cur[3],i); if(xx==cur[1]){ ss.pb({0,1}); } else if(xx==i){ ss.pb({2,3}); } else{ ss.pb({3,4}); } for(auto j:ss){ int x=getMedian(cur[j.a],cur[j.b],i); if(x==i){ int jj=j.a+1; vector<int> cur2; for(int ii=0;ii<jj;ii++){ cur2.pb(cur[ii]); } cur2.pb(i); for(int ii=jj;ii<cur.size();ii++){ cur2.pb(cur[ii]); } cur=cur2; break; } else if(x==cur[j.a]){ int jj=j.a; vector<int> cur2; for(int ii=0;ii<jj;ii++){ cur2.pb(cur[ii]); } cur2.pb(i); for(int ii=jj;ii<cur.size();ii++){ cur2.pb(cur[ii]); } cur=cur2; break; } else{ int jj=j.a+2; vector<int> cur2; for(int ii=0;ii<jj;ii++){ cur2.pb(cur[ii]); } cur2.pb(i); for(int ii=jj;ii<cur.size();ii++){ cur2.pb(cur[ii]); } cur=cur2; break; } } continue; } int st=0; for(auto j:ss){ int x=getMedian(cur[j.a],cur[j.b],i); if(x==i){ st=1; int jj=j.a+1; vector<int> cur2; for(int ii=0;ii<jj;ii++){ cur2.pb(cur[ii]); } cur2.pb(i); for(int ii=jj;ii<cur.size();ii++){ cur2.pb(cur[ii]); } cur=cur2; break; } else if(x==cur[j.a]){ st=1; int jj=j.a; vector<int> cur2; for(int ii=0;ii<jj;ii++){ cur2.pb(cur[ii]); } cur2.pb(i); for(int ii=jj;ii<cur.size();ii++){ cur2.pb(cur[ii]); } cur=cur2; break; } } if(st==0){ cur.pb(i); } } int ww[6]; for(int i=0;i<6;i++){ ww[i]=cur[i]; } answer(ww); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:8:15: warning: unused parameter 'T' [-Wunused-parameter]
    8 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:57:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |       for(int ii=jj;ii<cur.size();ii++){
      |                     ~~^~~~~~~~~~~
scales.cpp:70:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |       for(int ii=jj;ii<cur.size();ii++){
      |                     ~~^~~~~~~~~~~
scales.cpp:83:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   83 |       for(int ii=jj;ii<cur.size();ii++){
      |                     ~~^~~~~~~~~~~
scales.cpp:104:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  104 |     for(int ii=jj;ii<cur.size();ii++){
      |                   ~~^~~~~~~~~~~
scales.cpp:118:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  118 |     for(int ii=jj;ii<cur.size();ii++){
      |                   ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...