제출 #840556

#제출 시각아이디문제언어결과실행 시간메모리
840556PagodePaivaScales (IOI15_scales)C++17
0 / 100
1 ms304 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } void orderCoins(){ map <int, int> res; int maxval = getHeaviest(1, 2, 3); int sv = maxval; int maxval2 = getHeaviest(4, 5, 6); maxval = getHeaviest(maxval, maxval2, (maxval != 1 and maxval2 != 1? 1 : (maxval != 2 and maxval2 != 2 ? 2 : 3))); res[maxval] = 1; vector <int> a1; for(int i = 1;i <= 3;i++){ if(res[i] == 0) a1.push_back(i); } vector <int> a2; for(int i = 4;i <= 6;i++){ if(res[i] == 0) a2.push_back(i); } if(a1.size() == 2){ int a = a1[0]; int b = a1[1]; int t = getHeaviest(maxval2, a, b); res[t] = 2; } else{ int a = a2[0]; int b = a2[1]; int t = getHeaviest(sv, a, b); res[t] = 2; } vector <int> v; for(int i = 1;i <= 6;i++){ if(res[i] == 0) v.push_back(i); } int t = getHeaviest(v[0], v[1], v[2]); int pos = (t == v[0] ? 0 : (t == v[1] ? 1 : 2)); swap(v[0], v[pos]); t = getMedian(v[0], v[1], v[3]); if(t == v[0]){ res[v[3]] = 3; res[v[0]] = 4; t = getMedian(v[0], v[1], v[2]); if(t == v[1]){ res[v[1]] = 5; res[v[2]] = 6; } else{ res[v[2]] = 5; res[v[1]] = 6; } } else if(t == v[1]){ res[v[0]] = 3; int t = getNextLightest(maxval, v[1], v[3], v[2]); if(t == maxval){ res[v[2]] = 4; res[v[1]] = 5; res[v[3]] = 6; } else if(t == v[1]){ res[v[1]] = 4; res[v[3]] = 6; res[v[2]] = 5; } else{ res[v[1]] = 4; res[v[3]] = 5; res[v[2]] = 6; } } else{ res[v[0]] = 3; swap(v[1], v[3]); int t = getNextLightest(maxval, v[1], v[3], v[2]); if(t == maxval){ res[v[2]] = 4; res[v[1]] = 5; res[v[3]] = 6; } else if(t == v[1]){ res[v[1]] = 4; res[v[3]] = 6; res[v[2]] = 5; } else{ res[v[1]] = 4; res[v[3]] = 5; res[v[2]] = 6; } } vector <pair <int , int>> aa; for(int i = 1;i <= 6;i++){ aa.push_back({res[i], i}); } sort(aa.begin(), aa.end()); vector <int> ans; for(auto x : aa){ ans.push_back(x.second); } int W[6]; for(int i = 0;i < 6;i++){ W[i] = ans[i]; } answer(W); return; }

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

scales.cpp: In function 'void init(int)':
scales.cpp:6:15: warning: unused parameter 'T' [-Wunused-parameter]
    6 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:76:7: warning: declaration of 't' shadows a previous local [-Wshadow]
   76 |   int t = getNextLightest(maxval, v[1], v[3], v[2]);
      |       ^
scales.cpp:50:6: note: shadowed declaration is here
   50 |  int t = getHeaviest(v[0], v[1], v[2]);
      |      ^
scales.cpp:101:7: warning: declaration of 't' shadows a previous local [-Wshadow]
  101 |   int t = getNextLightest(maxval, v[1], v[3], v[2]);
      |       ^
scales.cpp:50:6: note: shadowed declaration is here
   50 |  int t = getHeaviest(v[0], v[1], v[2]);
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...