Submission #115506

#TimeUsernameProblemLanguageResultExecution timeMemory
115506E869120Scales (IOI15_scales)C++14
0 / 100
6 ms640 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;

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

int getLight(vector<int>V) {
	int ret = V[0], cx = 1;
	while (cx < (int)V.size()) {
		int u1 = ret, u2 = V[cx], u3 = cx + 1;
		if (u3 >= V.size()) {
			for (int i = 0; i < V.size(); i++) { if (V[u1] != V[i] && V[u2] != V[i]) { u3 = V[i]; break; } }
		}
		else u3 = V[cx + 1];
		
		int G = getLightest(u1, u2, u3);
		ret = G; cx += 2;
	}
	return ret;
}

void orderCoins() {
	vector<int>vec, L = {1, 2, 3, 4, 5, 6};
	for (int i = 1; i <= 3; i++) {
		int P = getLight(L); vec.push_back(P);
		vector<int> LL; for (int j = 0; j < L.size(); j++) { if (L[j] != P) LL.push_back(L[j]); }
		L = LL;
	}
	
	vector<int>I = L;
	vec.push_back(getLightest(I[0], I[1], I[2]));
	vec.push_back(getMedian(I[0], I[1], I[2]));
	for (int i = 1; i <= 6; i++) {
		bool flag = false; for (int j = 0; j < vec.size(); j++) { if (vec[j] == i) flag = true; }
		if (flag == false) vec.push_back(i);
	}
	
	int FinalAns[6]; for (int i = 0; i < 6; i++) FinalAns[i] = vec[i];
	answer(FinalAns);
}

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 'int getLight(std::vector<int>)':
scales.cpp:13:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (u3 >= V.size()) {
       ~~~^~~~~~~~~~~
scales.cpp:14:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < V.size(); i++) { if (V[u1] != V[i] && V[u2] != V[i]) { u3 = V[i]; break; } }
                    ~~^~~~~~~~~~
scales.cpp: In function 'void orderCoins()':
scales.cpp:28:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   vector<int> LL; for (int j = 0; j < L.size(); j++) { if (L[j] != P) LL.push_back(L[j]); }
                                   ~~^~~~~~~~~~
scales.cpp:36:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   bool flag = false; for (int j = 0; j < vec.size(); j++) { if (vec[j] == i) flag = true; }
                                      ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...