Submission #977272

# Submission time Handle Problem Language Result Execution time Memory
977272 2024-05-07T15:31:59 Z IUA_Hasin Scales (IOI15_scales) C++17
0 / 100
1 ms 600 KB
#include "scales.h"

#include <bits/stdc++.h>
#include <vector>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

#define endl                                          "\n"
#define ll                                            long long

ll t;
ll vis1[7];
ll vis2[7];

void init(int T) {
    t = T;
}

void orderCoins() {
    for(int i=0; i<7; i++){
        vis1[i] = 0;
        vis2[i] = 0;
    }

    int w[6];


    ll a = getHeaviest(1, 2, 3);
    ll b = getHeaviest(4, 5, 6);
    ll c = getHeaviest(a, b, 2);

    w[5] = c;
    vis2[c] = 1;

    ll a4;
    if(c==a){
        if(a==1){
            a4 = getHeaviest(b, 2, 3);
        } else if(a==2){
            a4 = getHeaviest(b, 1, 3);
        } else {
            a4 = getHeaviest(b, 2, 3);
        }
    } else {
        if(b==4){
            a4 = getHeaviest(a, 5, 6);
        } else if(b==5){
            a4 = getHeaviest(a, 4, 6);
        } else {
            a4 = getHeaviest(a, 4, 5);
        }
    }
    w[4] = a4;
    vis2[a4] = 1;

    // cout << c << " " << a4 << endl;

    std::vector<ll> v;
    for(int i=1; i<=6; i++){
        if(vis2[i]==0){
            v.push_back(i);
        }
    }

    ll a5 = getHeaviest(v[0], v[1], v[2]);
    ll a66;
    if(a5==v[0]){
        a66 = getHeaviest(a5, v[2], v[3]);
    } else if(a5==v[1]){
        a66 = getHeaviest(a5, v[2], v[3]);
    } else {
        a66 = getHeaviest(a5, v[1], v[3]);
    }
    w[3] = a66;
    vis2[a66] = 1;
    std::vector<ll> v1;
    for(int i=1; i<=6; i++){
        if(vis2[i]==0){
            v1.push_back(i);
        }
    }

    ll a7 = getHeaviest(v1[0], v1[1], v1[2]);
    ll a8 = getLightest(v1[0], v1[1], v1[2]);

    for(int i=0; i<3; i++){
        if(v1[i]==a7){
            w[2] = a7;
        } else if(v1[i]==a8){
            w[0] = a8;
        } else {
            w[1] = v1[i];
        }
    }

    answer(w);


}

Compilation message

scales.cpp: In function 'void orderCoins()':
scales.cpp:31:24: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   31 |     ll c = getHeaviest(a, b, 2);
      |                        ^
scales.cpp:31:27: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   31 |     ll c = getHeaviest(a, b, 2);
      |                           ^
scales.cpp:33:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   33 |     w[5] = c;
      |            ^
scales.cpp:39:30: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   39 |             a4 = getHeaviest(b, 2, 3);
      |                              ^
scales.cpp:41:30: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   41 |             a4 = getHeaviest(b, 1, 3);
      |                              ^
scales.cpp:43:30: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   43 |             a4 = getHeaviest(b, 2, 3);
      |                              ^
scales.cpp:47:30: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   47 |             a4 = getHeaviest(a, 5, 6);
      |                              ^
scales.cpp:49:30: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   49 |             a4 = getHeaviest(a, 4, 6);
      |                              ^
scales.cpp:51:30: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   51 |             a4 = getHeaviest(a, 4, 5);
      |                              ^
scales.cpp:54:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   54 |     w[4] = a4;
      |            ^~
scales.cpp:66:41: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   66 |     ll a5 = getHeaviest(v[0], v[1], v[2]);
      |                                         ^
scales.cpp:66:41: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:66:41: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:69:27: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   69 |         a66 = getHeaviest(a5, v[2], v[3]);
      |                           ^~
scales.cpp:69:41: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   69 |         a66 = getHeaviest(a5, v[2], v[3]);
      |                                         ^
scales.cpp:69:41: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:71:27: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   71 |         a66 = getHeaviest(a5, v[2], v[3]);
      |                           ^~
scales.cpp:71:41: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   71 |         a66 = getHeaviest(a5, v[2], v[3]);
      |                                         ^
scales.cpp:71:41: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:73:27: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   73 |         a66 = getHeaviest(a5, v[1], v[3]);
      |                           ^~
scales.cpp:73:41: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   73 |         a66 = getHeaviest(a5, v[1], v[3]);
      |                                         ^
scales.cpp:73:41: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:75:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   75 |     w[3] = a66;
      |            ^~~
scales.cpp:84:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   84 |     ll a7 = getHeaviest(v1[0], v1[1], v1[2]);
      |                                            ^
scales.cpp:84:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:84:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:85:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   85 |     ll a8 = getLightest(v1[0], v1[1], v1[2]);
      |                                            ^
scales.cpp:85:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:85:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:89:20: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   89 |             w[2] = a7;
      |                    ^~
scales.cpp:91:20: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   91 |             w[0] = a8;
      |                    ^~
scales.cpp:93:24: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   93 |             w[1] = v1[i];
      |                        ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Incorrect 0 ms 344 KB Output isn't correct
3 Runtime error 1 ms 348 KB Execution killed with signal 6
4 Runtime error 1 ms 344 KB Execution killed with signal 6
5 Incorrect 0 ms 344 KB Output isn't correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Runtime error 1 ms 344 KB Execution killed with signal 6
9 Runtime error 1 ms 348 KB Execution killed with signal 6
10 Runtime error 1 ms 348 KB Execution killed with signal 6
11 Runtime error 1 ms 348 KB Execution killed with signal 6
12 Runtime error 1 ms 348 KB Execution killed with signal 6
13 Runtime error 1 ms 348 KB Execution killed with signal 6
14 Runtime error 0 ms 348 KB Execution killed with signal 6
15 Runtime error 1 ms 348 KB Execution killed with signal 6
16 Runtime error 1 ms 348 KB Execution killed with signal 6
17 Incorrect 1 ms 512 KB Output isn't correct
18 Incorrect 0 ms 348 KB Output isn't correct
19 Runtime error 1 ms 348 KB Execution killed with signal 6
20 Runtime error 1 ms 348 KB Execution killed with signal 6
21 Runtime error 1 ms 348 KB Execution killed with signal 6
22 Incorrect 0 ms 348 KB Output isn't correct
23 Runtime error 1 ms 348 KB Execution killed with signal 6
24 Runtime error 1 ms 348 KB Execution killed with signal 6
25 Runtime error 1 ms 348 KB Execution killed with signal 6
26 Incorrect 0 ms 344 KB Output isn't correct
27 Incorrect 0 ms 348 KB Output isn't correct
28 Runtime error 1 ms 348 KB Execution killed with signal 6
29 Runtime error 1 ms 344 KB Execution killed with signal 6
30 Incorrect 0 ms 348 KB Output isn't correct
31 Runtime error 1 ms 348 KB Execution killed with signal 6
32 Runtime error 1 ms 348 KB Execution killed with signal 6
33 Runtime error 1 ms 468 KB Execution killed with signal 6
34 Incorrect 0 ms 348 KB Output isn't correct
35 Incorrect 0 ms 344 KB Output isn't correct
36 Incorrect 1 ms 600 KB Output isn't correct
37 Incorrect 0 ms 344 KB Output isn't correct
38 Incorrect 1 ms 348 KB Output isn't correct
39 Runtime error 1 ms 344 KB Execution killed with signal 6
40 Runtime error 1 ms 348 KB Execution killed with signal 6