Submission #815092

# Submission time Handle Problem Language Result Execution time Memory
815092 2023-08-08T12:18:45 Z kwongweng Scales (IOI15_scales) C++17
55.5556 / 100
1 ms 212 KB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define fi first
#define se second
#define H(a,b,c) getHeaviest(a,b,c)
#define L(a,b,c) getLightest(a,b,c)
#define M(a,b,c) getMedian(a,b,c)
#define NL(a,b,c,d) getNextLightest(a,b,c,d);

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

void orderCoins() {
    /* ... */
    int mx1 = H(1,2,3);
    int mn1 = L(1,2,3);
    int md1 = 6-mx1-mn1;
    int mx2 = H(4,5,6);
    int mn2 = L(4,5,6);
    int md2 = 15-mx2-mn2;
    vi seq1 = {mn1,md1,mx1};
    vi seq2 = {mn2,md2,mx2};

    int val = H(mx1,mx2,md1);
    vi ans;
    if (val==mx2){
        int cur=0;
        FOR(i,0,3){
            int val2 = NL(mn2,md2,mx2,seq1[i]);
            if (val2==mn2) ans.pb(seq1[i]);
            if (val2==md2){
                if (cur==0){ans.pb(mn2); cur++;}
                ans.pb(seq1[i]);
            }
            if (val2==mx2){
                if (cur==0){ans.pb(mn2); cur++;}
                if (cur==1){ans.pb(md2); cur++;}
                ans.pb(seq1[i]);
            }
        }
        if (cur==0){ans.pb(mn2); cur++;}
        if (cur==1){ans.pb(md2); cur++;}
        ans.pb(mx2);
    }else{
        int cur=0;
        FOR(i,0,3){
            int val2 = NL(mn1,md1,mx1,seq2[i]);
            if (val2==mn1) ans.pb(seq2[i]);
            if (val2==md1){
                if (cur==0){ans.pb(mn1); cur++;}
                ans.pb(seq2[i]);
            }
            if (val2==mx1){
                if (cur==0){ans.pb(mn1); cur++;}
                if (cur==1){ans.pb(md1); cur++;}
                ans.pb(seq2[i]);
            }
        }
        if (cur==0){ans.pb(mn1); cur++;}
        if (cur==1){ans.pb(md1); cur++;}
        ans.pb(mx1);
    }
    int W[] = {1, 2, 3, 4, 5, 6};
    FOR(i,0,6) W[i]=ans[i];
    answer(W);
}

Compilation message

scales.cpp: In function 'void init(int)':
scales.cpp:22:15: warning: unused parameter 'T' [-Wunused-parameter]
   22 | void init(int T) {
      |           ~~~~^
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Partially correct 0 ms 212 KB Output is partially correct
3 Partially correct 0 ms 212 KB Output is partially correct
4 Partially correct 0 ms 212 KB Output is partially correct
5 Partially correct 0 ms 212 KB Output is partially correct
6 Partially correct 0 ms 212 KB Output is partially correct
7 Partially correct 0 ms 212 KB Output is partially correct
8 Partially correct 0 ms 212 KB Output is partially correct
9 Partially correct 0 ms 212 KB Output is partially correct
10 Partially correct 0 ms 212 KB Output is partially correct
11 Partially correct 0 ms 212 KB Output is partially correct
12 Partially correct 0 ms 212 KB Output is partially correct
13 Partially correct 1 ms 212 KB Output is partially correct
14 Partially correct 0 ms 212 KB Output is partially correct
15 Partially correct 0 ms 212 KB Output is partially correct
16 Partially correct 0 ms 212 KB Output is partially correct
17 Partially correct 1 ms 212 KB Output is partially correct
18 Partially correct 0 ms 212 KB Output is partially correct
19 Partially correct 0 ms 212 KB Output is partially correct
20 Partially correct 0 ms 212 KB Output is partially correct
21 Partially correct 0 ms 212 KB Output is partially correct
22 Partially correct 0 ms 212 KB Output is partially correct
23 Partially correct 0 ms 212 KB Output is partially correct
24 Partially correct 1 ms 212 KB Output is partially correct
25 Partially correct 0 ms 212 KB Output is partially correct
26 Partially correct 0 ms 212 KB Output is partially correct
27 Partially correct 1 ms 212 KB Output is partially correct
28 Partially correct 1 ms 212 KB Output is partially correct
29 Partially correct 0 ms 212 KB Output is partially correct
30 Partially correct 0 ms 212 KB Output is partially correct
31 Partially correct 0 ms 212 KB Output is partially correct
32 Partially correct 0 ms 212 KB Output is partially correct
33 Partially correct 1 ms 212 KB Output is partially correct
34 Partially correct 0 ms 212 KB Output is partially correct
35 Partially correct 0 ms 212 KB Output is partially correct
36 Partially correct 0 ms 212 KB Output is partially correct
37 Partially correct 0 ms 212 KB Output is partially correct
38 Partially correct 0 ms 212 KB Output is partially correct
39 Partially correct 0 ms 212 KB Output is partially correct
40 Partially correct 0 ms 212 KB Output is partially correct