제출 #97504

#제출 시각아이디문제언어결과실행 시간메모리
97504wilwxkScales (IOI15_scales)C++11
0 / 100
20 ms432 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;


void init(int t) {
    mt19937 rng(time(0)^t);
}

void orderCoins() {
    int respf[]={1, 2, 3, 4, 5, 6};
    vector<int> resp;
    int v[]={0, 1, 2, 3, 4, 5, 6};
    random_shuffle(v+1, v+7);
    int a;

    a=getLightest(v[1], v[2], v[3]);
    if(v[2]==a) swap(v[1], v[2]);
    if(v[3]==a) swap(v[1], v[3]);
    a=getMedian(v[1], v[2], v[3]);
    if(v[3]==a) swap(v[2], v[3]);

    a=getLightest(v[4], v[5], v[6]);
    if(v[5]==a) swap(v[4], v[5]);
    if(v[6]==a) swap(v[4], v[6]);
    a=getMedian(v[4], v[5], v[6]);
    if(v[6]==a) swap(v[5], v[6]);

    // printf(";;; "); for(int i=1; i<=6; i++) printf("%d ", v[i]); printf("\n");

    int p=1;
    for(int i=4; i<=6; i++) {
        int cara=getNextLightest(v[1], v[2], v[3], v[i]);
        while(p<4&&v[p]!=cara) resp.push_back(v[p++]);
        resp.push_back(v[i]);
    }

    if(p==1) {
        resp.clear();
        int cara=getNextLightest(v[4], v[5], v[6], v[2]);
        if(cara==v[4]) {
            int cara2=getLightest(v[1], v[2], v[6]);
            if(cara2!=v[6]) resp={1, 2, 3, 4, 5, 6};
            else resp={4, 5, 6, 1, 2, 3};
        }
        else {
            p=4; while(v[p]!=cara) resp.push_back(v[p++]);
            for(int i=1; i<=3; i++) resp.push_back(v[i]);
            while(p<7) resp.push_back(v[p++]);
            for(int i=0; i<6; i++) respf[i]=resp[i];
        }
    }
    else {
        while(p<4) resp.push_back(v[p++]);
        for(int i=0; i<6; i++) respf[i]=resp[i];
    }
    answer(respf);

}

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

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...