Submission #134558

# Submission time Handle Problem Language Result Execution time Memory
134558 2019-07-23T03:55:10 Z tinjyu Scales (IOI15_scales) C++14
0 / 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=getHeaviest(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=getHeaviest(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 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Incorrect 2 ms 256 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 2 ms 256 KB Output isn't correct
8 Incorrect 2 ms 256 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Incorrect 2 ms 256 KB Output isn't correct
12 Incorrect 2 ms 380 KB Output isn't correct
13 Incorrect 2 ms 256 KB Output isn't correct
14 Incorrect 2 ms 376 KB Output isn't correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Partially correct 2 ms 376 KB Output is partially correct
17 Incorrect 2 ms 376 KB Output isn't correct
18 Incorrect 2 ms 376 KB Output isn't correct
19 Incorrect 2 ms 256 KB Output isn't correct
20 Incorrect 2 ms 376 KB Output isn't correct
21 Incorrect 2 ms 380 KB Output isn't correct
22 Incorrect 2 ms 376 KB Output isn't correct
23 Partially correct 2 ms 376 KB Output is partially correct
24 Incorrect 2 ms 376 KB Output isn't correct
25 Partially correct 2 ms 376 KB Output is partially correct
26 Incorrect 2 ms 376 KB Output isn't correct
27 Incorrect 2 ms 376 KB Output isn't correct
28 Partially correct 2 ms 376 KB Output is partially correct
29 Incorrect 2 ms 376 KB Output isn't correct
30 Incorrect 2 ms 376 KB Output isn't correct
31 Incorrect 2 ms 376 KB Output isn't correct
32 Incorrect 2 ms 256 KB Output isn't correct
33 Incorrect 2 ms 256 KB Output isn't correct
34 Incorrect 2 ms 376 KB Output isn't correct
35 Incorrect 2 ms 256 KB Output isn't correct
36 Incorrect 2 ms 376 KB Output isn't correct
37 Incorrect 2 ms 256 KB Output isn't correct
38 Incorrect 2 ms 256 KB Output isn't correct
39 Incorrect 2 ms 376 KB Output isn't correct
40 Incorrect 2 ms 256 KB Output isn't correct