Submission #73614

#TimeUsernameProblemLanguageResultExecution timeMemory
73614aleksamScales (IOI15_scales)C++14
0 / 100
3 ms620 KiB
//#include "graderlib.c"

#include "scales.h"
#include <bits/stdc++.h>

using namespace std;


int T;

void init(int t) {
    t=T;
}

struct coin{
	int id;
};

int Max(int a, int b, int c){
	return getHeaviest(a, b, c);
}

int Min(int a, int b, int c){
	return getLightest(a, b, c);
}

int Mid(int a, int b, int c){
	return getMedian(a, b, c);
}

int l[3], r[3], u[6];
void orderCoins() {
    /*
	int W[] = {1, 2, 3, 4, 5, 6};
    answer(W);*/
    l[0]=Min(1, 2, 3);
    l[2]=Max(1, 2, 3);
    l[1]=6-l[0]-l[2];
    r[0]=Min(4, 5, 6);
    r[2]=Max(4, 5, 6);
    r[1]=4+5+6-r[0]-r[2];
    //printf("l:%d %d %d r:%d %d %d\n", l[0], l[1], l[2], r[0], r[1], r[2]);
    int cl=0, cr=0;
    while(cl<2 && cr<3){
    	u[cl+cr]=Min(l[cl], l[cl+1], r[cr]);
    	if(u[cl+cr]==l[cl])cl++;
		else cr++;
	}
	while(cr<2 && cl<3){
		u[cl+cr]=Min(l[cl], r[cr+1], r[cr]);
    	if(u[cl+cr]==l[cl])cl++;
		else cr++;
	}
	if(cr==2 && cl==2){//cerr<<"slucaj 1";
		u[5]=Max(l[2], r[2], l[1]);
		u[4]=21-u[0]-u[1]-u[2]-u[3]-u[5];
		answer(u);
		return;
	}
	if(cl==3){//cerr<<"slucaj 2";
		u[5]=r[2];
		u[4]=r[1];	
		answer(u);
		return;
	}
	if(cr==2){//cerr<<"slucaj 3";
		u[5]=l[2];
		u[4]=l[1];
	}
	answer(u);
}

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:11:15: warning: parameter 't' set but not used [-Wunused-but-set-parameter]
 void init(int t) {
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...