답안 #831837

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
831837 2023-08-20T15:55:05 Z qin 저울 (IOI15_scales) C++14
45.4545 / 100
1 ms 304 KB

    #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){
    		
    }

Compilation message

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){
      |               ~~~~^
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 212 KB Output is partially correct
2 Partially correct 0 ms 212 KB Output is partially correct
3 Partially correct 1 ms 212 KB Output is partially correct
4 Partially correct 0 ms 212 KB Output is partially correct
5 Partially correct 0 ms 212 KB Output is partially correct
6 Partially correct 1 ms 212 KB Output is partially correct
7 Partially correct 0 ms 212 KB Output is partially correct
8 Partially correct 0 ms 212 KB Output is partially correct
9 Partially correct 1 ms 212 KB Output is partially correct
10 Partially correct 1 ms 212 KB Output is partially correct
11 Partially correct 0 ms 296 KB Output is partially correct
12 Partially correct 1 ms 296 KB Output is partially correct
13 Partially correct 0 ms 300 KB Output is partially correct
14 Partially correct 1 ms 212 KB Output is partially correct
15 Partially correct 1 ms 212 KB Output is partially correct
16 Partially correct 1 ms 212 KB Output is partially correct
17 Partially correct 0 ms 304 KB Output is partially correct
18 Partially correct 1 ms 212 KB Output is partially correct
19 Partially correct 1 ms 212 KB Output is partially correct
20 Partially correct 0 ms 292 KB Output is partially correct
21 Partially correct 0 ms 212 KB Output is partially correct
22 Partially correct 0 ms 212 KB Output is partially correct
23 Partially correct 1 ms 212 KB Output is partially correct
24 Partially correct 0 ms 212 KB Output is partially correct
25 Partially correct 0 ms 212 KB Output is partially correct
26 Partially correct 0 ms 212 KB Output is partially correct
27 Partially correct 1 ms 212 KB Output is partially correct
28 Partially correct 0 ms 300 KB Output is partially correct
29 Partially correct 0 ms 300 KB Output is partially correct
30 Partially correct 0 ms 296 KB Output is partially correct
31 Partially correct 1 ms 212 KB Output is partially correct
32 Partially correct 0 ms 304 KB Output is partially correct
33 Partially correct 1 ms 212 KB Output is partially correct
34 Partially correct 0 ms 296 KB Output is partially correct
35 Partially correct 0 ms 212 KB Output is partially correct
36 Partially correct 0 ms 212 KB Output is partially correct
37 Partially correct 0 ms 212 KB Output is partially correct
38 Partially correct 1 ms 212 KB Output is partially correct
39 Partially correct 1 ms 212 KB Output is partially correct
40 Partially correct 0 ms 212 KB Output is partially correct