Submission #72836

#TimeUsernameProblemLanguageResultExecution timeMemory
72836square1001저울 (IOI15_scales)C++14
45.45 / 100
4 ms904 KiB
#include "scales.h"
#include <vector>
using namespace std;

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

void orderCoins() {
    vector<int> v = { 1, 2, 3, 4, 5, 6 }, w;
    for(int i = 0; i < 3; ++i) {
		int cur = v[0];
		for(int j = 2; j < v.size(); j += 2) {
			cur = getLightest(cur, v[j], v[j - 1]);
		}
		if(v.size() % 2 == 0) {
			cur = getLightest(cur, v.back(), (cur == v[0] ? v[1] : v[0]));
		}
		w.push_back(cur);
		vector<int> nv;
		for(int j : v) {
			if(j != cur) nv.push_back(j);
		}
		v = nv;
	}
	w[3] = getLightest(v[0], v[1], v[2]);
	w[4] = getMedian(v[0], v[1], v[2]);
	w[5] = v[0] + v[1] + v[2] - w[3] - w[4];
    int W[] = {w[0], w[1], w[2], w[3], w[4], w[5]};
    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 orderCoins()':
scales.cpp:13:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 2; j < v.size(); j += 2) {
                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...