Submission #92636

#TimeUsernameProblemLanguageResultExecution timeMemory
92636tugushkaScales (IOI15_scales)C++14
45.45 / 100
2 ms504 KiB
#include "scales.h"
#include<bits/stdc++.h>
using namespace std;

void init(int T) {
    /* ... */
}

vector < int > v;

void kick(int x){
	/*
	for(int i = 0 ; i < v.size() ; i++){
		cout << v[i] << ' ';
	} cout << endl;
	cout << "Kick : " << x << endl;
	*/
	
	for(int i = 0 ; i < v.size() ; i++){
		if( x == v[i] ){
			for(int j = i+1 ; j < v.size() ; j++){
				swap(v[j], v[j-1]);
			}
			break;
		}
	}
	v.pop_back();
}

void orderCoins() {
	v.clear();
	for(int i = 1 ; i <= 6 ; i++) v.push_back(i);
	
    int W[] = {1, 2, 3, 4, 5, 6};
    
    int x = getHeaviest(1, 2, 3);
    int y = getHeaviest(4, 5, 6);
    int z;
    if( x != 1 ) z = 1;
    else z = 2;
    
    x = getHeaviest( x, y, z );
    W[5] = x; kick( W[5] );
    
    W[4] = getHeaviest( v[0], v[1], getHeaviest( v[2], v[3], v[4] ) ); kick(W[4]);
    
	x = getHeaviest( v[0], v[1], v[2] );
	
	for(int i = 1 ; i <= 6 ; i++){
		if( i != x && v[3] != i && W[5] != i && W[4] != i ){
			y = i;
			break;
		}
	}
	
	W[3] = getHeaviest( x, v[3], y ); kick(W[3]);
	
	W[2] = getHeaviest( v[0], v[1], v[2] ); kick(W[2]);
	W[1] = getMedian( v[0], v[1], v[2] ); kick(W[1]);
	W[0] = v[0];
	
    answer(W);
}

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:5:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void kick(int)':
scales.cpp:19:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < v.size() ; i++){
                  ~~^~~~~~~~~~
scales.cpp:21:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j = i+1 ; j < v.size() ; j++){
                      ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...