Submission #134572

# Submission time Handle Problem Language Result Execution time Memory
134572 2019-07-23T04:13:39 Z tinjyu Scales (IOI15_scales) C++14
71.4286 / 100
2 ms 380 KB
#include "scales.h"
#include <iostream>
#include <vector>
using namespace std;
void init(int T) {
    /* ... */
}

void orderCoins() {
    /* ... */

    long long int a=1,b=2,c=3,d=4,e=5,f=6;
    int tmp=getHeaviest(a,b,c);
    //cout<<tmp<<endl;
    if(tmp==b)
    {
        swap(a,b);
    }
    else if(tmp==c)
    {
        swap(a,c);    //_f = fopen("scales.in", "r");
    }
    //cout<<a<<" "<<b<<" "<<c<<endl;
    tmp=getNextLightest(a,b,c,d);
    if(tmp==a)
    {
        swap(d,b);
        tmp=getLightest(b,c,d);
        if(tmp==c)
        {
            swap(c,d);
        }
    }
    else if(tmp==b)
    {
        tmp=getHeaviest(b,c,d);
        if(tmp==c)
        {
            swap(b,c);
        }
        else if(tmp==b)
        {
            swap(c,d);
        }
        else{
            swap(d,b);
            swap(a,b);
        }
    }
    else
    {
        tmp=getHeaviest(b,c,d);
        if(tmp==d)
        {
            swap(d,c);
            swap(c,b);
            swap(a,b);
        }
        else if(tmp==c)
        {
            swap(b,c);
            swap(c,d);
        }
    }
    //cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
    tmp=getMedian(b,c,e);
    if(tmp==b)
    {
        int t=e;
        e=d;
        d=c;
        c=b;
        b=t;
        tmp=getHeaviest(a,b,c);
        if(tmp==b)
        {
            swap(a,b);
        }
    }
    else if(tmp==e)
    {
        int t=e;
        e=d;
        d=c;
        c=t;
    }
    else
    {
        tmp=getLightest(c,d,e);
        if(tmp==d)
        {
            swap(d,e);
        }
    }
    //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;
    tmp=getNextLightest(a,c,e,f);
    if(tmp==a)
    {
        int t=f;
        f=e;
        e=d;
        d=c;
        c=t;
        tmp=getLightest(a,b,c);
        if(tmp==b)
        {
            swap(c,b);
        }
    }
    else if(tmp==c)
    {
        int t=f;
        f=e;
        e=t;
        tmp=getLightest(c,d,e);
        if(tmp==d)
        {
            swap(d,e);
        }
    }
    else if(tmp==e)
    {
        tmp=getLightest(d,e,f);
        if(tmp==e)
        {
            int t=f;
            f=e;
            e=d;
            d=c;
            c=b;
            b=a;
            a=t;
        }
    }
    //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<" "<<f<<endl;
    int W[]={f,e,d,c,b,a};
    answer(W);
}

Compilation message

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:13:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     int tmp=getHeaviest(a,b,c);
                              ^
scales.cpp:13:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:13:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:24:32: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     tmp=getNextLightest(a,b,c,d);
                                ^
scales.cpp:24:32: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:24:32: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:24:32: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:28:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         tmp=getLightest(b,c,d);
                              ^
scales.cpp:28:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:28:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:36:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         tmp=getHeaviest(b,c,d);
                              ^
scales.cpp:36:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:36:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:52:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         tmp=getHeaviest(b,c,d);
                              ^
scales.cpp:52:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:52:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:66:24: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     tmp=getMedian(b,c,e);
                        ^
scales.cpp:66:24: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:66:24: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:69:15: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         int t=e;
               ^
scales.cpp:74:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         tmp=getHeaviest(a,b,c);
                              ^
scales.cpp:74:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:74:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:82:15: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         int t=e;
               ^
scales.cpp:89:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         tmp=getLightest(c,d,e);
                              ^
scales.cpp:89:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:89:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:96:32: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     tmp=getNextLightest(a,c,e,f);
                                ^
scales.cpp:96:32: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:96:32: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:96:32: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:99:15: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         int t=f;
               ^
scales.cpp:104:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         tmp=getLightest(a,b,c);
                              ^
scales.cpp:104:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:104:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:112:15: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         int t=f;
               ^
scales.cpp:115:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         tmp=getLightest(c,d,e);
                              ^
scales.cpp:115:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:115:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:123:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         tmp=getLightest(d,e,f);
                              ^
scales.cpp:123:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:123:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:126:19: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
             int t=f;
                   ^
scales.cpp:136:25: warning: narrowing conversion of 'f' from 'long long int' to 'int' inside { } [-Wnarrowing]
     int W[]={f,e,d,c,b,a};
                         ^
scales.cpp:136:25: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:136:25: warning: narrowing conversion of 'e' from 'long long int' to 'int' inside { } [-Wnarrowing]
scales.cpp:136:25: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:136:25: warning: narrowing conversion of 'd' from 'long long int' to 'int' inside { } [-Wnarrowing]
scales.cpp:136:25: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:136:25: warning: narrowing conversion of 'c' from 'long long int' to 'int' inside { } [-Wnarrowing]
scales.cpp:136:25: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:136:25: warning: narrowing conversion of 'b' from 'long long int' to 'int' inside { } [-Wnarrowing]
scales.cpp:136:25: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
scales.cpp:136:25: warning: narrowing conversion of 'a' from 'long long int' to 'int' inside { } [-Wnarrowing]
scales.cpp:136:25: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 376 KB Output is partially correct
2 Partially correct 2 ms 376 KB Output is partially correct
3 Partially correct 2 ms 376 KB Output is partially correct
4 Partially correct 2 ms 376 KB Output is partially correct
5 Partially correct 2 ms 256 KB Output is partially correct
6 Partially correct 2 ms 256 KB Output is partially correct
7 Partially correct 2 ms 376 KB Output is partially correct
8 Partially correct 2 ms 376 KB Output is partially correct
9 Partially correct 2 ms 256 KB Output is partially correct
10 Partially correct 2 ms 376 KB Output is partially correct
11 Partially correct 2 ms 256 KB Output is partially correct
12 Partially correct 2 ms 256 KB Output is partially correct
13 Partially correct 2 ms 376 KB Output is partially correct
14 Partially correct 2 ms 376 KB Output is partially correct
15 Partially correct 2 ms 376 KB Output is partially correct
16 Partially correct 2 ms 376 KB Output is partially correct
17 Partially correct 2 ms 376 KB Output is partially correct
18 Partially correct 2 ms 376 KB Output is partially correct
19 Partially correct 2 ms 376 KB Output is partially correct
20 Partially correct 2 ms 380 KB Output is partially correct
21 Partially correct 2 ms 256 KB Output is partially correct
22 Partially correct 2 ms 256 KB Output is partially correct
23 Partially correct 2 ms 256 KB Output is partially correct
24 Partially correct 2 ms 376 KB Output is partially correct
25 Partially correct 2 ms 376 KB Output is partially correct
26 Partially correct 2 ms 376 KB Output is partially correct
27 Partially correct 2 ms 376 KB Output is partially correct
28 Partially correct 2 ms 376 KB Output is partially correct
29 Partially correct 2 ms 256 KB Output is partially correct
30 Partially correct 2 ms 376 KB Output is partially correct
31 Partially correct 2 ms 376 KB Output is partially correct
32 Partially correct 2 ms 376 KB Output is partially correct
33 Partially correct 2 ms 376 KB Output is partially correct
34 Partially correct 2 ms 252 KB Output is partially correct
35 Partially correct 2 ms 376 KB Output is partially correct
36 Partially correct 2 ms 376 KB Output is partially correct
37 Partially correct 2 ms 380 KB Output is partially correct
38 Partially correct 2 ms 380 KB Output is partially correct
39 Partially correct 2 ms 376 KB Output is partially correct
40 Partially correct 2 ms 376 KB Output is partially correct