Submission #1077892

#TimeUsernameProblemLanguageResultExecution timeMemory
1077892marizaScales (IOI15_scales)C++14
0 / 100
1 ms348 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; void init(int T) { } void orderCoins() { 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(getLightest(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]=getLightest(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 'void init(int)':
scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
    7 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:33:34: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   33 |             y.insert(getLightest(a,b,c));
      |                                  ^
scales.cpp:33:36: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   33 |             y.insert(getLightest(a,b,c));
      |                                    ^
scales.cpp:33:38: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   33 |             y.insert(getLightest(a,b,c));
      |                                      ^
scales.cpp:38:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   38 |         ans[i]=*y.begin();
      |                ^~~~~~~~~~
scales.cpp:45:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   45 |     ans[3]=getLightest(a,b,c);
      |                        ^
scales.cpp:45:26: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   45 |     ans[3]=getLightest(a,b,c);
      |                          ^
scales.cpp:45:28: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   45 |     ans[3]=getLightest(a,b,c);
      |                            ^
scales.cpp:46:22: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   46 |     ans[4]=getMedian(a,b,c);
      |                      ^
scales.cpp:46:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   46 |     ans[4]=getMedian(a,b,c);
      |                        ^
scales.cpp:46:26: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   46 |     ans[4]=getMedian(a,b,c);
      |                          ^
scales.cpp:47:38: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   47 |     if(min(ans[3],ans[4])==b) ans[5]=a;
      |                                      ^
scales.cpp:48:43: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   48 |     else if(max(ans[3],ans[4])==b) ans[5]=c;
      |                                           ^
scales.cpp:49:17: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   49 |     else ans[5]=b;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...