답안 #1037425

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037425 2024-07-28T20:19:27 Z mindiyak 저울 (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 == c)continue;
        b = i;
    }
    
    d = getLightest(4,5,6);
    f = getHeaviest(4,5,6);
    FOR(i,4,7){
        if(i == d || i == f)continue;
        e = i;
    }

    // cout << a << b << c << d << e << f << endl;

    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:81:25: warning: 'e' may be used uninitialized in this function [-Wmaybe-uninitialized]
   81 |     arr[4] = getHeaviest(temp[0],temp[1],temp[2]);
      |              ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
scales.cpp:47:11: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   47 |     int a,b,c,d,e,f;
      |           ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Incorrect 0 ms 344 KB Output isn't correct
11 Incorrect 1 ms 348 KB Output isn't correct
12 Incorrect 0 ms 344 KB Output isn't correct
13 Incorrect 0 ms 344 KB Output isn't correct
14 Incorrect 0 ms 348 KB Output isn't correct
15 Incorrect 0 ms 348 KB Output isn't correct
16 Incorrect 0 ms 348 KB Output isn't correct
17 Incorrect 0 ms 348 KB Output isn't correct
18 Incorrect 0 ms 348 KB Output isn't correct
19 Incorrect 0 ms 348 KB Output isn't correct
20 Incorrect 0 ms 348 KB Output isn't correct
21 Incorrect 0 ms 348 KB Output isn't correct
22 Incorrect 0 ms 348 KB Output isn't correct
23 Incorrect 0 ms 348 KB Output isn't correct
24 Incorrect 0 ms 348 KB Output isn't correct
25 Incorrect 0 ms 348 KB Output isn't correct
26 Incorrect 1 ms 348 KB Output isn't correct
27 Incorrect 0 ms 348 KB Output isn't correct
28 Incorrect 0 ms 348 KB Output isn't correct
29 Incorrect 0 ms 348 KB Output isn't correct
30 Incorrect 0 ms 348 KB Output isn't correct
31 Incorrect 0 ms 348 KB Output isn't correct
32 Incorrect 0 ms 348 KB Output isn't correct
33 Incorrect 1 ms 348 KB Output isn't correct
34 Incorrect 0 ms 348 KB Output isn't correct
35 Incorrect 0 ms 348 KB Output isn't correct
36 Incorrect 1 ms 348 KB Output isn't correct
37 Incorrect 0 ms 348 KB Output isn't correct
38 Incorrect 0 ms 348 KB Output isn't correct
39 Incorrect 0 ms 348 KB Output isn't correct
40 Incorrect 0 ms 348 KB Output isn't correct