제출 #99155

#제출 시각아이디문제언어결과실행 시간메모리
99155eriksuenderhaufScales (IOI15_scales)C++11
45.45 / 100
3 ms512 KiB
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "scales.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%I64d", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%I64d\n", (n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;

void init(int t) {
}

void answer2(vi ans) {
    int tmp[] = {ans[0],ans[1],ans[2],ans[3],ans[4],ans[5]};
    answer(tmp);
}

void orderCoins() {
    //srand(time(0));
    vi c = {1, 2, 3, 4, 5, 6};
    //random_shuffle(c.begin(), c.end());
    int x = getLightest(c[0], c[1], c[2]);
    int y = getLightest(c[3], c[4], c[5]);
    int x2 = getHeaviest(c[0], c[1], c[2]);
    int y2 = getHeaviest(c[3], c[4], c[5]);
    //int z = getLightest(x, y, (x == 1) ? 2 : 1);
    vi a = {x, c[0]+c[1]+c[2] - x - x2, x2};
    vi b = {y, c[3]+c[4]+c[5] - y - y2, y2};
    x = getNextLightest(a[0], a[1], a[2], b[0]);
    if (x == a[1]) {
        //nx = {a[0], b[0], a[1], a[2]};
        x = getMedian(b[1], b[2], a[1]);
        if (x == a[1]) {
            //nx = {a[0], b[0], b[1], a[1], a[2]};
            if (getHeaviest(a[1], a[2], b[2]) == a[2])
                answer2({a[0], b[0], b[1], a[1], b[2], a[2]});
            else
                answer2({a[0], b[0], b[1], a[1], a[2], b[2]});
            //nx = {a[0], b[0], a[1], b[1], a[2]};
        } else if (x == b[1]) {
            //nx = {a[0], b[0], a[1], a[2], b[1]};
            x = getMedian(b[1], b[2], a[2]);
            if (x == b[1])
                answer2({a[0], b[0], a[1], a[2], b[1], b[2]});
            else if (x == b[2])
                answer2({a[0], b[0], a[1], b[1], b[2], a[2]});
            else
                answer2({a[0], b[0], a[1], b[1], a[2], b[2]});
        } else if (x == b[2])
            answer2({a[0], b[0], b[1], b[2], a[1], a[2]});
        return;
    } else if (x == a[2]) {
        //nx = {a[0], a[1], b[0], a[2]};
        x = getMedian(b[1], b[2], a[2]);
        if (x == b[1])
            answer2({a[0], a[1], b[0], a[2], b[1], b[2]});
        else if (x == b[2])
            answer2({a[0], a[1], b[0], b[1], b[2], a[2]});
        else
            answer2({a[0], a[1], b[0], b[1], a[2], b[2]});
    } else {
        if (getLightest(b[0], a[0], b[1]) == a[0]) {
            answer2({a[0],a[1],a[2],b[0],b[1],b[2]});
            return;
        }
        //cerr <<"X:";
        // nx = {b[0], a[0], a[1], a[2]};
        x = getMedian(a[1], b[1], b[2]);
        if (x == a[1]) {
        //cerr <<"XX:";
            x = getMedian(a[0], b[1], b[0]);
            y = getMedian(a[1], b[2], a[2]);
            if (x == b[1] && y == b[2])
                answer2({b[0], b[1], a[0], a[1], b[2], a[2]});
            else if (x == b[1] && y == a[2])
                answer2({b[0], b[ 1], a[0], a[1], a[2], b[2]});
            else if (x == a[0] && y == b[2])
                answer2({b[0], a[0], b[1], a[1], b[2], a[2]});
            else
                answer2({b[0], a[0], b[1], a[1], a[2], b[2]});
        } else if (x == b[1]) {
        //cerr <<"XY:";
            x = getMedian(b[1], b[2], a[2]);
            if (x == b[1])
                answer2({b[0], a[0], a[1], a[2], b[1], b[2]});
            else if (x == b[2])
                answer2({b[0], a[0], a[1], b[1], b[2], a[2]});
            else
                answer2({b[0], a[0], a[1], b[1], a[2], b[2]});
        } else {
        //cerr <<"XZ:";
            x = getMedian(b[1], b[2], a[0]);
            if (x == b[1])
                answer2({b[0], a[0], b[1], b[2], a[1], a[2]});
            else if (x == b[2])
                answer2({b[0], b[1], b[2], a[0], a[1], a[2]});
            else
                answer2({b[0], b[1], a[0], b[2], a[1], a[2]});
        }
    }
}

/*int main()
{
    ofstream fout("scales-3.in");
    fout << "720\n";
    vi x = {1,2,3,4,5,6};
    do {
        for (int i = 0; i < 6; i++) fout << x[i] << " ";
        fout << "\n";
    } while (next_permutation(x.begin(), x.end()));
    return 0;
}*/

컴파일 시 표준 에러 (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++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:32:15: warning: unused parameter 't' [-Wunused-parameter]
 void init(int t) {
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...