제출 #802696

#제출 시각아이디문제언어결과실행 시간메모리
802696FatihSolak저울 (IOI15_scales)C++17
55.56 / 100
2 ms304 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
void init(int T) {
    /* ... */
}

void orderCoins() {
    vector<int> v = {1};
    for(int i = 2;i<=4;i+=2){
        v[0] = getHeaviest(v[0],i,i+1);
    }
    int tmp = 5 - (v[0] == 5);
    int val = getMedian(v[0],tmp,6);
    if(val == tmp){
        v = {6,tmp,v[0]};
    }
    else if(val == 6){
        v = {tmp,6,v[0]};
    }
    else{
        v = {tmp,v[0],6};
    }
    for(int i = 1;i<=6;i++){
        bool ok = 1;
        for(auto u:v){
            if(u == i)
                ok = 0;
        }
        if(!ok)
            continue;
        int val = getNextLightest(v[v.size() - 3],v[v.size()-2],v[v.size()-1],i);
        if(val == v[v.size() - 3] && v.size() > 3){
            val = getNextLightest(v[0],v[1],v[2],i);
        }
        vector<int> tmp;
        for(auto u:v){
            if(u == val)
                tmp.push_back(i);
            tmp.push_back(u);
        }
        v = tmp;
    }
    int W[] = {v[0],v[1],v[2],v[3],v[4],v[5]};
    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) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:32:13: warning: declaration of 'val' shadows a previous local [-Wshadow]
   32 |         int val = getNextLightest(v[v.size() - 3],v[v.size()-2],v[v.size()-1],i);
      |             ^~~
scales.cpp:14:9: note: shadowed declaration is here
   14 |     int val = getMedian(v[0],tmp,6);
      |         ^~~
scales.cpp:36:21: warning: declaration of 'tmp' shadows a previous local [-Wshadow]
   36 |         vector<int> tmp;
      |                     ^~~
scales.cpp:13:9: note: shadowed declaration is here
   13 |     int tmp = 5 - (v[0] == 5);
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...