제출 #619623

#제출 시각아이디문제언어결과실행 시간메모리
619623MounirScales (IOI15_scales)C++14
0 / 100
2 ms468 KiB
#include "scales.h"
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define chmax(x, v) x = max(x, v)
#define chmin(x, v) x = min(x, v)
#define pii pair<int, int>
#define pb push_back
#define sz(x) (int)x.size()
#define x first
#define y second
//#define int long long
using namespace std;

void init(int T) {
    /* ... */
}

void orderCoins() {
    int W[6];
    set<int> reste = {1, 2, 3, 4, 5, 6};
    for (int i = 0; i < 4; ++i){
        int mini = *reste.begin();
        vector<int> file;
        for (int a : reste)
            file.pb(a);
        reverse(all(file));
        file.pop_back();
        reverse(all(file));
        int pasMini = -1;
        for (int i = 0; i < sz(file); i += 2){
            int avant = mini;
            if (i + 1 < sz(file)) {
                mini = getLightest(mini, file[i], file[i + 1]);
                for (int j : {i, i + 1}){
                    if (mini != j)
                        pasMini = j;
                }
                if (avant != mini)
                    pasMini = avant;
            }
            else 
                mini = getLightest(mini, pasMini, file[i]);
        }

        reste.erase(mini);
        W[i] = mini;
    }

    int a = *reste.begin();
    reste.erase(reste.begin());
    int b = *reste.begin();
    W[5] = getHeaviest(W[0], a, b);
    W[4] = a;
    if (W[5] == W[4])
        W[4] = b;
    answer(W);
    return;
}

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

scales.cpp: In function 'void init(int)':
scales.cpp:14:15: warning: unused parameter 'T' [-Wunused-parameter]
   14 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:30:18: warning: declaration of 'i' shadows a previous local [-Wshadow]
   30 |         for (int i = 0; i < sz(file); i += 2){
      |                  ^
scales.cpp:21:14: note: shadowed declaration is here
   21 |     for (int i = 0; i < 4; ++i){
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...