Submission #1037422

# Submission time Handle Problem Language Result Execution time Memory
1037422 2024-07-28T20:15:15 Z mindiyak Scales (IOI15_scales) C++14
0 / 100
1 ms 348 KB
#include "scales.h"
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cmath>
#include <set>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<int, int> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define nl endl
#define S second
#define lb lower_bound
#define ub upper_bound
#define aint(x) x.begin(), x.end()
#define raint(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;

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

void orderCoins() {
    int a,b,c,d,e,f;
    a = getLightest(1,2,3);
    c = getHeaviest(1,2,3);
    FOR(i,1,4){
        if(i == a || i == b)continue;
        b = i;
    }
    
    d = getLightest(4,5,6);
    f = getHeaviest(4,5,6);
    FOR(i,4,7){
        if(i == a || i == b)continue;
        e = i;
    }

    vi arr(6,0);
    arr[0] = getLightest(a,b,d);
    arr[5] = getHeaviest(e,f,b);

    // cout << 0 <<  " " << arr[0] << endl;
    // cout << 5 <<  " " << arr[5] << endl;

    vi temp = {-1,b,e};
    if(arr[0] == a)temp[0] = d;
    else temp[0] = a;
    arr[1] = getLightest(temp[0],temp[1],temp[2]);

    // cout << 1 <<  " " << arr[1] << endl;

    temp = {-1,b,e};
    if(arr[5] == c)temp[0] = f;
    else temp[0] = c;
    arr[4] = getHeaviest(temp[0],temp[1],temp[2]);

    // cout << 4 <<  " " << arr[4] << endl;

    temp = vi();
    set<int> arr2;
    vi arr3;
    for(int j:arr){
        arr2.insert(j);
    }
    FOR(i,1,7){
        if(arr2.count(i) == 0)arr3.pb(i);
    }

    arr[2] = getLightest(arr3[0],arr3[1],arr[5]);
    if(arr[2] == arr3[0])arr[3] = arr3[1];
    else arr[3] = arr3[0];

    // cout << 2 <<  " " << arr[2] << endl;
    // cout << 3 <<  " " << arr[3] << endl;


    int arr4[6];
    FOR(i,0,6)arr4[i] = arr[i];

    answer(arr4);
}

Compilation message

scales.cpp: In function 'void init(int)':
scales.cpp:42:15: warning: unused parameter 'T' [-Wunused-parameter]
   42 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:79:25: warning: 'e' may be used uninitialized in this function [-Wmaybe-uninitialized]
   79 |     arr[4] = getHeaviest(temp[0],temp[1],temp[2]);
      |              ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
scales.cpp:51:24: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   51 |         if(i == a || i == b)continue;
      |                      ~~^~~~
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 6
2 Runtime error 0 ms 348 KB Execution killed with signal 6
3 Runtime error 0 ms 348 KB Execution killed with signal 6
4 Runtime error 0 ms 348 KB Execution killed with signal 6
5 Incorrect 0 ms 348 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Runtime error 0 ms 348 KB Execution killed with signal 6
8 Runtime error 0 ms 348 KB Execution killed with signal 6
9 Runtime error 1 ms 348 KB Execution killed with signal 6
10 Incorrect 0 ms 348 KB Output isn't correct
11 Runtime error 0 ms 348 KB Execution killed with signal 6
12 Runtime error 1 ms 348 KB Execution killed with signal 6
13 Incorrect 0 ms 348 KB Output isn't correct
14 Runtime error 0 ms 344 KB Execution killed with signal 6
15 Runtime error 1 ms 348 KB Execution killed with signal 6
16 Incorrect 0 ms 348 KB Output isn't correct
17 Runtime error 0 ms 348 KB Execution killed with signal 6
18 Runtime error 1 ms 348 KB Execution killed with signal 6
19 Incorrect 0 ms 348 KB Output isn't correct
20 Runtime error 0 ms 348 KB Execution killed with signal 6
21 Runtime error 0 ms 348 KB Execution killed with signal 6
22 Runtime error 0 ms 348 KB Execution killed with signal 6
23 Incorrect 0 ms 348 KB Output isn't correct
24 Runtime error 1 ms 348 KB Execution killed with signal 6
25 Incorrect 0 ms 348 KB Output isn't correct
26 Runtime error 0 ms 348 KB Execution killed with signal 6
27 Incorrect 0 ms 348 KB Output isn't correct
28 Incorrect 1 ms 344 KB Output isn't correct
29 Incorrect 0 ms 348 KB Output isn't correct
30 Runtime error 0 ms 348 KB Execution killed with signal 6
31 Runtime error 0 ms 348 KB Execution killed with signal 6
32 Runtime error 0 ms 348 KB Execution killed with signal 6
33 Runtime error 0 ms 348 KB Execution killed with signal 6
34 Runtime error 1 ms 348 KB Execution killed with signal 6
35 Incorrect 0 ms 348 KB Output isn't correct
36 Incorrect 1 ms 348 KB Output isn't correct
37 Runtime error 0 ms 348 KB Execution killed with signal 6
38 Runtime error 1 ms 348 KB Execution killed with signal 6
39 Runtime error 0 ms 348 KB Execution killed with signal 6
40 Runtime error 1 ms 348 KB Execution killed with signal 6