제출 #596944

#제출 시각아이디문제언어결과실행 시간메모리
596944PiejanVDC저울 (IOI15_scales)C++17
47.05 / 100
1 ms212 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int t) { } void orderCoins() { int vis[7][7][7]; for(int i = 1 ; i <= 6 ; i++) for(int j = 1 ; j <= 6 ; j++) for(int k = 1 ; k <= 6 ; k++) vis[i][j][k] = 0; int ans[6] = {1, 2, 3, 4, 5, 6}; int a = getLightest(1, 2, 3); vis[1][2][3] = a; int b = getLightest(4, 5, 6); vis[4][5][6] = b; int c; for(int i = 1 ; i <= 6 ; i++) if(i != a && i != b) c = i; ans[0] = getLightest(a, b, c); vis[a][b][c] = ans[0]; vector<int>r; for(int i = 1 ; i <= 6 ; i++) if(i != ans[0]) r.push_back(i); int d; if(vis[r[2]][r[3]][r[4]]) d = vis[r[2]][r[3]][r[4]]; else d = vis[r[2]][r[3]][r[4]] = getLightest(r[2], r[3], r[4]); if(vis[r[0]][r[1]][d]) a = vis[r[0]][r[1]][d]; else a = vis[r[0]][r[1]][d] = getLightest(r[0], r[1], d); ans[1] = a; r.clear(); for(int i = 1 ; i <= 6 ; i++) if(i != ans[0] && i != ans[1]) r.push_back(i); if(vis[r[0]][r[1]][r[2]]) a = vis[r[0]][r[1]][r[2]]; else a = vis[r[0]][r[1]][r[2]] = getLightest(r[0], r[1], r[2]); r.clear(); for(int i = 1 ; i <= 6 ; i++) if(i != ans[0] && i != ans[1] && i != a) r.push_back(i); if(vis[a][r[0]][r[2]]) ans[2] = vis[a][r[0]][r[2]]; else ans[2] = vis[a][r[0]][r[2]] = getLightest(a, r[0], r[2]); r.clear(); for(int i = 1 ; i <= 6 ; i++) if(i != ans[0] && i != ans[1] && i != ans[2]) r.push_back(i); if(vis[r[0]][r[1]][r[2]]) ans[3] = vis[r[0]][r[1]][r[2]]; else ans[3] = vis[r[0]][r[1]][r[2]] = getLightest(r[0], r[1], r[2]); r.clear(); for(int i = 1 ; i <= 6 ; i++) if(i != ans[0] && i != ans[1] && i != ans[2] && i != ans[3]) r.push_back(i); ans[5] = getHeaviest(r[0], r[1], ans[0]); for(int i = 1 ; i <= 6 ; i++) if(i != ans[0] && i != ans[1] && i != ans[2] && i != ans[3] && i != ans[5]) ans[4] = i; answer(ans); }

컴파일 시 표준 에러 (stderr) 메시지

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 't' [-Wunused-parameter]
    5 | void init(int t) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:27:18: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |     vis[a][b][c] = ans[0];
      |     ~~~~~~~~~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...