제출 #801931

#제출 시각아이디문제언어결과실행 시간메모리
801931_martynas저울 (IOI15_scales)C++11
38.46 / 100
1 ms304 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } /* my queries are constant 10 Q+x = 10 x = 10-Q solve for Q: 100 ----------- = 38.4615 2*(10-Q)/5+1 Q = 6 not hidden any more! */ void orderCoins() { /* ... */ int first_half_light = getLightest(1, 2, 3); int first_half_heavy = getHeaviest(1, 2, 3); int first_half_mid = 1^2^3^first_half_light^first_half_heavy; int second_half_light = getLightest(4, 5, 6); int second_half_heavy = getHeaviest(4, 5, 6); int second_half_mid = 4^5^6^second_half_light^second_half_heavy; vector<char> order = {'L', 'L', 'L'}; // L - first half, R - second half vector<int> check = {4, 5, 6}; auto insert_after = [](vector<char> &v, int cnt) { if(cnt == 3) { v.push_back('R'); } else { for(int i = 0; i < v.size(); i++) { if(cnt == 0) { v.insert(v.begin()+i, 'R'); return; } if(v[i] == 'L') cnt--; } } }; for(int x : check) { int resp = getNextLightest(first_half_light, first_half_mid, first_half_heavy, x); if(resp == first_half_light) { int resp1 = getLightest(first_half_light, first_half_mid, x); if(resp1 == x) { insert_after(order, 0); } else { insert_after(order, 3); } } else { if(resp == first_half_mid) { insert_after(order, 1); } else { insert_after(order, 2); } } } int W[6]; vector<int> first_half = {first_half_light, first_half_mid, first_half_heavy}; vector<int> second_half = {second_half_light, second_half_mid, second_half_heavy}; for(int i = 0, first_it = 0, second_it = 0; i < 6; i++) { if(order[i] == 'L') { W[i] = first_half[first_it++]; } else { W[i] = second_half[second_it++]; } } answer(W); }

컴파일 시 표준 에러 (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 lambda function:
scales.cpp:38:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             for(int i = 0; i < v.size(); i++) {
      |                            ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...