제출 #115507

#제출 시각아이디문제언어결과실행 시간메모리
115507E869120저울 (IOI15_scales)C++14
45.45 / 100
3 ms384 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 (u1 != V[i] && 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); }

컴파일 시 표준 에러 (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 (u1 != V[i] && 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...