Submission #619840

#TimeUsernameProblemLanguageResultExecution timeMemory
619840aminScales (IOI15_scales)C++14
0 / 100
1 ms224 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; void init(int T) { /* ... */ }/* long getLightest(long x,long xx,long xxx) { x--; xx--; xxx--; if(a[x]<a[xx]&&a[x]<a[xxx]) { return x+1; }else if(a[xx]<a[x]&&a[xx]<a[xxx]) { return xx+1; }else return xxx+1; } long getHeaviest(long x,long xx,long xxx) { x--; xx--; xxx--; if(a[x]>a[xx]&&a[x]>a[xxx]) { return x+1; }else if(a[xx]>a[x]&&a[xx]>a[xxx]) { return xx+1; }else return xxx+1; } long getMedian(long x,long xx,long xxx) { x--; xx--; xxx--; if(a[x]>a[xx]&&a[x]<a[xxx]) { return x+1; }else if(a[xx]>a[x]&&a[xx]<a[xxx]) { return xx+1; } if(a[x]<a[xx]&&a[x]>a[xxx]) { return x+1; } if(a[xx]<a[x]&&a[xx]>a[xxx]) { return xx+1; } return xxx+1; } */ void orderCoins() { /* ... */ int W[] = {1, 2, 3, 4, 5, 6}; long o=getLightest(1,2,3); long oo=getLightest(4,5,6); swap(W[0],W[o-1]); swap(W[3],W[oo-1]); vector<long>ans; o=getLightest(W[0],W[1],W[3]); cout<<o<<endl; vector<long>v; ans.push_back(o); if(W[3]==o) { swap(W[0],W[3]); swap(W[1],W[4]); swap(W[2],W[5]); } long k=getLightest(W[1],W[2],W[3]); cout<<k<<endl; ans.push_back(k); for(long i=0;i<6;i++) { if(W[i]!=k&&W[i]!=o) { v.push_back(W[i]); } } long z=getMedian(v[2],v[3],ans[0]); long x=getLightest(v[0],v[1],z); for(long i=0;i<4;i++) { if(v[i]==x) { v.erase(v.begin()+i); } } ans.push_back(x); o=getLightest(v[0],v[1],v[2]); oo=getHeaviest(v[0],v[1],v[2]); ans.push_back(o); for(long i=0;i<3;i++) { if(v[i]!=o&&v[i]!=oo) { ans.push_back(v[i]); break; } } ans.push_back(oo); for(long i=0;i<6;i++) { W[i]=ans[i]; } answer(W); }/* int main() { for(long i=0;i<6;i++) { cin>>a[i]; } vector<long>f; f=orderCoins(); for(long i=0;i<6;i++) { cout<<f[i]<<' '; } cout<<endl; }*/

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
    4 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:93:38: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   93 |     long z=getMedian(v[2],v[3],ans[0]);
      |                                      ^
scales.cpp:93:38: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:93:38: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:94:35: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   94 |     long x=getLightest(v[0],v[1],z);
      |                                   ^
scales.cpp:94:35: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:94:34: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   94 |     long x=getLightest(v[0],v[1],z);
      |                                  ^
scales.cpp:103:33: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
  103 |     o=getLightest(v[0],v[1],v[2]);
      |                                 ^
scales.cpp:103:33: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:103:33: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:104:34: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
  104 |     oo=getHeaviest(v[0],v[1],v[2]);
      |                                  ^
scales.cpp:104:34: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:104:34: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
scales.cpp:118:15: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'} to 'int' may change value [-Wconversion]
  118 |     W[i]=ans[i];
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...