Submission #134572

#TimeUsernameProblemLanguageResultExecution timeMemory
134572tinjyuScales (IOI15_scales)C++14
71.43 / 100
2 ms380 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...