Submission #1077999

#TimeUsernameProblemLanguageResultExecution timeMemory
1077999marizaScales (IOI15_scales)C++14
45.45 / 100
1 ms436 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; map<tuple<ll,ll,ll>,ll> m; ll ask(ll a, ll b, ll c){ if(m.find({a,b,c})==m.end()) m[{a,b,c}]=getLightest(a,b,c); return m[{a,b,c}]; } void init(int T) { } void orderCoins() { m.clear(); set<ll> x; for(ll i=1; i<=6; i++){ x.insert(i); } int ans[6]; ll z=0; for(ll i=0; i<3; i++){ set<ll> y; for(ll j=1; j<=6; j++){ if(x.find(j)!=x.end()) y.insert(j); } while(y.size()>1){ if(y.size()==2) y.insert(z); ll a=*y.begin(); y.erase(a); ll b=*y.begin(); y.erase(b); ll c=*y.begin(); y.erase(c); // cout<<i<<" "<<y.size()<<" "<<z<<endl; y.insert(ask(a,b,c)); if(a!=*y.begin()) z=a; else z=b; } ans[i]=*y.begin(); x.erase(*y.begin()); } ll a=*x.begin(); x.erase(a); ll b=*x.begin(); x.erase(b); ll c=*x.begin(); x.erase(c); ans[3]=ask(a,b,c); ans[4]=getMedian(a,b,c); if(min(ans[3],ans[4])==b) ans[5]=a; else if(max(ans[3],ans[4])==b) ans[5]=c; else ans[5]=b; answer(ans); }

Compilation message (stderr)

scales.cpp: In function 'll ask(ll, ll, ll)':
scales.cpp:9:57: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
    9 |     if(m.find({a,b,c})==m.end()) m[{a,b,c}]=getLightest(a,b,c);
      |                                                         ^
scales.cpp:9:59: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
    9 |     if(m.find({a,b,c})==m.end()) m[{a,b,c}]=getLightest(a,b,c);
      |                                                           ^
scales.cpp:9:61: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
    9 |     if(m.find({a,b,c})==m.end()) m[{a,b,c}]=getLightest(a,b,c);
      |                                                             ^
scales.cpp: In function 'void init(int)':
scales.cpp:13:15: warning: unused parameter 'T' [-Wunused-parameter]
   13 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:46:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   46 |         ans[i]=*y.begin();
      |                ^~~~~~~~~~
scales.cpp:53:15: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   53 |     ans[3]=ask(a,b,c);
      |            ~~~^~~~~~~
scales.cpp:54:22: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   54 |     ans[4]=getMedian(a,b,c);
      |                      ^
scales.cpp:54:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   54 |     ans[4]=getMedian(a,b,c);
      |                        ^
scales.cpp:54:26: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   54 |     ans[4]=getMedian(a,b,c);
      |                          ^
scales.cpp:55:38: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   55 |     if(min(ans[3],ans[4])==b) ans[5]=a;
      |                                      ^
scales.cpp:56:43: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   56 |     else if(max(ans[3],ans[4])==b) ans[5]=c;
      |                                           ^
scales.cpp:57:17: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   57 |     else ans[5]=b;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...