제출 #831837

#제출 시각아이디문제언어결과실행 시간메모리
831837qin저울 (IOI15_scales)C++14
45.45 / 100
1 ms304 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; void orderCoins(){ vector<int> v1, v2; int t1 = getLightest(1, 2, 3), t3 = getHeaviest(1, 2, 3); int tmp = 1; for(int i = 1; i <= 3; ++i) if(i != t1 && i != t3) tmp = i; v1 = {t3, tmp, t1}; t1 = getLightest(4, 5, 6), t3 = getHeaviest(4, 5, 6); for(int i = 4; i <= 6; ++i) if(i != t1 && i != t3) tmp = i; v2 = {t3, tmp, t1}; vector<int> wynik; while(!v1.empty() || !v2.empty()){ if(v1.size() == (size_t) 1 && v2.size() == (size_t) 1){ int tmp = getMedian(wynik[0], v1.back(), v2.back()); if(v1.back() == tmp) wynik.emplace_back(v1.back()), wynik.emplace_back(v2.back()); else wynik.emplace_back(v2.back()), wynik.emplace_back(v1.back()); v1.pop_back(), v2.pop_back(); continue; } if(v1.empty()) while(!v2.empty()) wynik.emplace_back(v2.back()), v2.pop_back(); if(v2.empty()) while(!v1.empty()) wynik.emplace_back(v1.back()), v1.pop_back(); if(v1.size() && v2.size()){ if(v2.size() > v1.size()) swap(v1, v2); int tmp = getLightest(v1.back(), v2.back(), v1[0]); if(v1.back() == tmp) wynik.emplace_back(v1.back()), v1.pop_back(); else wynik.emplace_back(v2.back()), v2.pop_back(); } } int w[6]; for(int i = 0; i < 6; ++i) w[i] = wynik[i]; answer(w); } void init(int T){ }

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

scales.cpp: In function 'void orderCoins()':
scales.cpp:18:15: warning: declaration of 'tmp' shadows a previous local [-Wshadow]
   18 |           int tmp = getMedian(wynik[0], v1.back(), v2.back());
      |               ^~~
scales.cpp:9:13: note: shadowed declaration is here
    9 |         int tmp = 1;
      |             ^~~
scales.cpp:28:15: warning: declaration of 'tmp' shadows a previous local [-Wshadow]
   28 |           int tmp = getLightest(v1.back(), v2.back(), v1[0]);
      |               ^~~
scales.cpp:9:13: note: shadowed declaration is here
    9 |         int tmp = 1;
      |             ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:37:19: warning: unused parameter 'T' [-Wunused-parameter]
   37 |     void init(int T){
      |               ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...