Submission #64428

#TimeUsernameProblemLanguageResultExecution timeMemory
64428IvanCScales (IOI15_scales)C++17
55.56 / 100
4 ms660 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; void init(int T){ // printf("T %d casos de teste\n",T); } void orderCoins(){ // printf("Oi\n"); // Passo 1 : ordernar 1,2,3 vi P = {1,2,3,4,5,6}; random_shuffle(P.begin(),P.end()); vi W; int r1 = getLightest(P[0],P[1],P[2]); //printf("Meu primeiro resultado %d\n",r1); int r2 = getMedian(P[0],P[1],P[2]); //printf("Meu segundo resultado %d\n",r2); W.push_back(r1);W.push_back(r2);W.push_back((P[0] + P[1] + P[2]) - (r1 + r2)); // Passo 2 : inserir o 4 int r3 = getMedian(W[0],W[1],P[3]); if(r3 == W[0]){ vi A = {P[3],W[0],W[1],W[2]}; W = A; } else if(r3 == P[3]){ vi A = {W[0],P[3],W[1],W[2]}; W = A; } else{ int r4 = getHeaviest(W[0],W[2],P[3]); if(r4 == P[3]){ W.push_back(P[3]); } else{ vi A = {W[0],W[1],P[3],W[2]}; W = A; } } // Passo 3 : inserir o 5 int r5 = getMedian(W[0],W[1],P[4]); if(r5 == W[0]){ vi A = {P[4],W[0],W[1],W[2],W[3]}; W = A; } else if(r5 == P[4]){ vi A = {W[0],P[4],W[1],W[2],W[3]}; W = A; } else{ int r6 = getMedian(W[2],W[3],P[4]); if(r6 == W[2]){ vi A = {W[0],W[1],P[4],W[2],W[3]}; W = A; } else if(r6 == P[4]){ vi A = {W[0],W[1],W[2],P[4],W[3]}; W = A; } else{ W.push_back(P[4]); } } // Passo 4 : inserir o 6 int r7 = getMedian(W[1],W[2],P[5]); if(r7 == P[5]){ vi A = {W[0],W[1],P[5],W[2],W[3],W[4]}; W = A; } else if(r7 == W[1]){ int r8 = getLightest(W[0],W[1],P[5]); if(r8 == P[5]){ vi A = {P[5],W[0],W[1],W[2],W[3],W[4]}; W = A; } else{ vi A = {W[0],P[5],W[1],W[2],W[3],W[4]}; W = A; } } else{ int r8 = getMedian(W[3],W[4],P[5]); if(r8 == P[5]){ vi A = {W[0],W[1],W[2],W[3],P[5],W[4]}; W = A; } else if(r8 == W[3]){ vi A = {W[0],W[1],W[2],P[5],W[3],W[4]}; W = A; } else{ W.push_back(P[5]); } } int ANS[6]; for(int i = 0;i<6;i++) ANS[i] = W[i]; answer(ANS); }

Compilation message (stderr)

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T){
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...