답안 #206390

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
206390 2020-03-03T08:04:40 Z batmend 저울 (IOI15_scales) C++14
0 / 100
6 ms 632 KB
#include "scales.h"
#include<bits/stdc++.h>
using namespace std;


int pos[6] = {0, 1, 2, 3, 4, 5};
int ma;
int med;
int val0, val1, val2, val3;


void init(int T) {
}

void orderCoins() {
    /* ... */
    int W[6] = {1, 2, 3, 4, 5, 6};
	ma = getHeaviest(1, 2, 3);
    swap(W[ma], W[2]);
    swap(pos[ma], pos[2]);
    ma = getHeaviest(4, 5, 6);
    swap(W[ma], W[5]);
    swap(pos[ma], pos[5]);
    

    ma = getHeaviest(W[1], W[2], W[5]);
    bool w2wasmax = 0;
    if (ma == W[2]) {
    	swap(pos[W[2]], pos[W[5]]);
    	swap(W[2], W[5]);
    	w2wasmax = 1;
    }
    if (w2wasmax == 1) {
    	ma = getHeaviest(W[0], W[1], W[2]);
    }
    if (w2wasmax == 0) {
    	ma = getHeaviest(W[3], W[4], W[2]);
    }
    int val = W[4];
    swap(W[pos[ma]], W[4]);
    swap(pos[val], pos[ma]);

    ma = getHeaviest(W[1], W[2], W[3]);
    val = W[3];
    swap(W[pos[ma]], W[3]);
    swap(pos[ma], pos[val]);
    med = getMedian(W[0], W[1], W[3]);
    val0 = W[0];
    val1 = W[1];
    val3 = W[3];
    if (med == val0) {
		swap(pos[W[0]], pos[W[1]]);
		swap(W[0], W[1]);
    }
    if (med == val3) {
			swap(pos[W[3]], pos[W[0]]);
			swap(W[0], W[3]);
			swap(pos[W[3]], pos[W[1]]);
			swap(W[1], W[3]);
    }
    med = getMedian(W[0], W[1], W[2]);
    val0 = W[0];
    val1 = W[1]; 
    val2 = W[2];
	if (med == val0) {
			swap(pos[W[0]], pos[W[2]]);
			swap(W[0], W[2]);
			swap(pos[W[1]], pos[W[0]]);
			swap(W[1], W[0]);
    }
    if (med == val2) {
			swap(pos[W[1]], pos[W[2]]);
			swap(W[1], W[2]);
    }
	answer(W);
}

Compilation message

scales.cpp: In function 'void init(int)':
scales.cpp:12:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Incorrect 5 ms 256 KB Output isn't correct
6 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 6 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Incorrect 5 ms 256 KB Output isn't correct
16 Incorrect 5 ms 376 KB Output isn't correct
17 Incorrect 5 ms 256 KB Output isn't correct
18 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Incorrect 5 ms 256 KB Output isn't correct
20 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Incorrect 5 ms 256 KB Output isn't correct
24 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Incorrect 6 ms 256 KB Output isn't correct
26 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Incorrect 5 ms 256 KB Output isn't correct
29 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Incorrect 5 ms 256 KB Output isn't correct
32 Incorrect 5 ms 376 KB Output isn't correct
33 Incorrect 5 ms 256 KB Output isn't correct
34 Incorrect 5 ms 376 KB Output isn't correct
35 Incorrect 5 ms 376 KB Output isn't correct
36 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)