제출 #58573

#제출 시각아이디문제언어결과실행 시간메모리
58573ngkan146저울 (IOI15_scales)C++11
55.56 / 100
4 ms668 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { /* do nothing */ } void orderCoins() { int res[6]; vector <int> lst; for(int i=1;i<=6;i++) lst.push_back(i); int tmp; tmp = getLightest(lst[0], lst[1], lst[2]); if (tmp == lst[1]) swap(lst[0], lst[1]); else if (tmp == lst[2]) swap(lst[0], lst[2]); tmp = getLightest(lst[0], lst[3], lst[4]); if (tmp == lst[3]) swap(lst[0], lst[3]); else if (tmp == lst[4]) swap(lst[0], lst[4]); tmp = getMedian(lst[0], lst[2], lst[5]); if (tmp == lst[0]) swap(lst[0], lst[5]), swap(lst[1], lst[5]); // lst[5] < lst[0] < lst[2]; else if (tmp == lst[2]) swap(lst[1], lst[2]), swap(lst[2], lst[5]); // lst[0] < lst[2] < lst[5] else if (tmp == lst[5]) swap(lst[1], lst[5]); // lst[0] < lst[5] < lst[2]; //after swap: lst[0] is smallest, lst[1] < lst[2] tmp = getLightest(lst[1], lst[3], lst[4]); if (tmp == lst[3]) swap(lst[1], lst[3]); else if (tmp == lst[4]) swap(lst[1], lst[4]); tmp = getMedian(lst[1], lst[3], lst[5]); if (tmp == lst[1]) swap(lst[1], lst[5]), swap(lst[2], lst[5]); // lst[5] < lst[1] < lst[3]; else if (tmp == lst[3]) swap(lst[2], lst[3]), swap(lst[3], lst[5]); // lst[1] < lst[3] < lst[5] else if (tmp == lst[5]) swap(lst[2], lst[5]); // lst[1] < lst[5] < lst[3]; //after swap: lst[1] is smallest, lst[2] < lst[3] tmp = getLightest(lst[2], lst[4], lst[5]); if (tmp == lst[4]) swap(lst[2], lst[4]); else if (tmp == lst[5]) swap(lst[2], lst[5]); // after swap: 0, 1, 2 correct, (3,4,5?) tmp = getLightest(lst[3], lst[4], lst[5]); if (tmp == lst[4]) swap(lst[3], lst[4]); else if (tmp == lst[5]) swap(lst[3], lst[5]); tmp = getMedian(lst[3], lst[4], lst[5]); if (tmp == lst[5]) swap(lst[4], lst[5]); for(int i=0;i<6;i++) res[i] = lst[i]; answer(res); }

컴파일 시 표준 에러 (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) {
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...