제출 #1068501

#제출 시각아이디문제언어결과실행 시간메모리
1068501ArthuroWich저울 (IOI15_scales)C++17
45.45 / 100
1 ms604 KiB
#include "scales.h"
#include<bits/stdc++.h>
using namespace std;
void init(int T) {
    
}
int mn[6][6][6];
int querymin(int a, int b, int c) {
    vector<int> s = {a, b, c};
    sort(s.begin(), s.end());
    if (mn[a][b][c]) {
        return mn[a][b][c];
    } else {
        mn[a][b][c] = getLightest(a, b, c);
        return mn[a][b][c];
    }
}
void orderCoins() {
    int W[6];
    for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 6; j++) {
            for (int k = 0; k < 6; k++) {
                mn[i][j][k] = 0;
            }
        }
    }
    vector<int> a = {1, 2, 3, 4, 5, 6};
    int j = 0;
    while(a.size() != 3) {
        int sh = querymin(a[0], a[1], a[2]);
        if (a.size() == 4) {
             if (sh != a[0]) {
                sh = querymin(sh, a[0], a[3]);
            } else {
                sh = querymin(sh, a[1], a[3]);
            }
        } else if (a.size() == 5) {
            sh = querymin(sh, a[3], a[4]);
        } else if (a.size() == 6) {
            sh = querymin(sh, a[3], a[4]);
            if (sh != a[0]) {
                sh = querymin(sh, a[0], a[5]);
            } else {
                sh = querymin(sh, a[1], a[5]);
            }
            
        }
        W[j] = sh;
        j++;
        a.erase(find(a.begin(), a.end(), sh));
    }
    W[j] = querymin(a[0], a[1], a[2]);
    j++;
    W[j] = getMedian(a[0], a[1], a[2]);
    j++;
    a.erase(find(a.begin(), a.end(), W[j-1]));
    a.erase(find(a.begin(), a.end(), W[j-2]));
    W[j] = a[0];
    answer(W);
}

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

scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
    4 | void init(int T) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...