Submission #532549

#TimeUsernameProblemLanguageResultExecution timeMemory
532549ivan24Scales (IOI15_scales)C++14
45.45 / 100
1 ms300 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; using ll = long long int; typedef vector<ll> vi; typedef vector<vi> vvi; typedef pair<ll,ll> ii; typedef vector<ii> vii; typedef vector<vii> vvii; ll min (ll x, ll y){ return ((x < y) ? x : y); } ll max (ll x, ll y){ return ((x > y) ? x : y); } void init(int t) { /* ... */ } void orderCoins() { /* ... */ int w[] = {1, 2, 3, 4, 5, 6}; ll l_ar[3], r_ar[3]; l_ar[0] = getLightest(1,2,3); l_ar[1] = getMedian(1,2,3); l_ar[2] = 6-l_ar[0]-l_ar[1]; r_ar[0] = getLightest(4,5,6); r_ar[1] = getMedian(4,5,6); r_ar[2] = 15-r_ar[0]-r_ar[1]; ll p_r = 0, p_l = 0; while (p_r != 3 || p_l != 3){ if (p_r == 3){ w[p_l+p_r] = l_ar[p_l]; p_l++; }else if (p_l == 3){ w[p_l+p_r] = r_ar[p_r]; p_r++; }else{ ll cur; if (p_l == 2 && p_r == 2){ cur = getMedian(l_ar[1],l_ar[2],r_ar[2]); }else if (p_r == 2){ cur = getLightest(l_ar[p_l],l_ar[p_l+1],r_ar[p_r]); }else if (p_l == 2){ cur = getLightest(l_ar[p_l],r_ar[p_r+1],r_ar[p_r]); }else{ cur = getLightest(l_ar[p_l],r_ar[p_r+1],r_ar[p_r]); } w[p_l+p_r] = cur; if (cur == l_ar[p_l]){ p_l++; }else{ p_r++; } } } w[5] = 21; for (ll i = 0; 4 >= i; i++) w[5] -= w[i]; answer(w); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:20:15: warning: unused parameter 't' [-Wunused-parameter]
   20 | void init(int t) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:39:34: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   39 |             w[p_l+p_r] = l_ar[p_l];
      |                          ~~~~~~~~^
scales.cpp:42:34: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   42 |             w[p_l+p_r] = r_ar[p_r];
      |                          ~~~~~~~~^
scales.cpp:47:39: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   47 |                 cur = getMedian(l_ar[1],l_ar[2],r_ar[2]);
      |                                 ~~~~~~^
scales.cpp:47:47: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   47 |                 cur = getMedian(l_ar[1],l_ar[2],r_ar[2]);
      |                                         ~~~~~~^
scales.cpp:47:55: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   47 |                 cur = getMedian(l_ar[1],l_ar[2],r_ar[2]);
      |                                                 ~~~~~~^
scales.cpp:49:43: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   49 |                 cur = getLightest(l_ar[p_l],l_ar[p_l+1],r_ar[p_r]);
      |                                   ~~~~~~~~^
scales.cpp:49:55: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   49 |                 cur = getLightest(l_ar[p_l],l_ar[p_l+1],r_ar[p_r]);
      |                                             ~~~~~~~~~~^
scales.cpp:49:65: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   49 |                 cur = getLightest(l_ar[p_l],l_ar[p_l+1],r_ar[p_r]);
      |                                                         ~~~~~~~~^
scales.cpp:51:43: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   51 |                 cur = getLightest(l_ar[p_l],r_ar[p_r+1],r_ar[p_r]);
      |                                   ~~~~~~~~^
scales.cpp:51:55: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   51 |                 cur = getLightest(l_ar[p_l],r_ar[p_r+1],r_ar[p_r]);
      |                                             ~~~~~~~~~~^
scales.cpp:51:65: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   51 |                 cur = getLightest(l_ar[p_l],r_ar[p_r+1],r_ar[p_r]);
      |                                                         ~~~~~~~~^
scales.cpp:53:43: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   53 |                 cur = getLightest(l_ar[p_l],r_ar[p_r+1],r_ar[p_r]);
      |                                   ~~~~~~~~^
scales.cpp:53:55: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   53 |                 cur = getLightest(l_ar[p_l],r_ar[p_r+1],r_ar[p_r]);
      |                                             ~~~~~~~~~~^
scales.cpp:53:65: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   53 |                 cur = getLightest(l_ar[p_l],r_ar[p_r+1],r_ar[p_r]);
      |                                                         ~~~~~~~~^
scales.cpp:55:26: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   55 |             w[p_l+p_r] = cur;
      |                          ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...