제출 #68380

#제출 시각아이디문제언어결과실행 시간메모리
68380AlphaRazra저울 (IOI15_scales)C++14
33.33 / 100
4 ms880 KiB
#include<bits/stdc++.h> #include "scales.h" using namespace std; int jawab[7]; bool sudah[7]; void init(int T) { } void orderCoins() { memset(sudah, false, sizeof(sudah)); int W[6]; int a[3], b[3]; a[0] = getLightest(1, 2, 3); a[1] = getMedian(1, 2, 3); a[2] = getHeaviest(1, 2, 3); b[0] = getLightest(4, 5, 6); b[1] = getMedian(4, 5, 6); b[2] = getHeaviest(4, 5, 6); int halo = getLightest(a[0], b[0], a[2]); int ringan; if(halo == a[0]){ jawab[a[0]] = 1; ringan = a[0]; sudah[a[0]] = true; }else if(halo == b[0]){ jawab[b[0]] = 1; ringan = b[0]; sudah[b[0]] = true; } int idx1 = 2, idx2 = 2; int haha = 6; while(true){ int now = getHeaviest(a[idx1], b[idx2], ringan); if(now == a[idx1]){ jawab[a[idx1]] = haha; sudah[a[idx1]] = true; haha--; idx1--; if(sudah[a[idx1]] || idx1 == -1){ break; } }else if(now == b[idx2]){ jawab[b[idx2]] = haha; sudah[b[idx2]] = true; haha--; idx2--; if(sudah[b[idx2]] || idx2 == -1){ break; } } } if(sudah[a[idx1]] || idx1 == -1){ while(!sudah[b[idx2]] && idx2 > -1){ jawab[b[idx2]] = haha; sudah[b[idx2]] = true; haha--; idx2--; } }else{ while(!sudah[a[idx1]] && idx1 > -1){ jawab[a[idx1]] = haha; sudah[a[idx1]] = true; haha--; idx1--; } } for(int i = 1; i <= 6; i++){ W[jawab[i] - 1] = i; } answer(W); }

컴파일 시 표준 에러 (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:8:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:40:49: warning: 'ringan' may be used uninitialized in this function [-Wmaybe-uninitialized]
   int now = getHeaviest(a[idx1], b[idx2], ringan);
                                                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...