Submission #1075685

#TimeUsernameProblemLanguageResultExecution timeMemory
1075685TB_Scales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; #define ll long long #define fo(i, n) for(ll i = 0; i<(n); i++) #define F first #define S second #define pb push_back #define deb(x) cout << #x << " = " << (x) << endl #define deb2(x, y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl typedef vector<ll> vl; typedef vector<vl> vvl; void init(int T) { } void orderCoins() { int W[] = {-1, -1, -1, -1, -1, -1}; int t1 = getLightest(1, 2, 3); int t2 = getLightest(4, 5, 6); vl a1, a2; fo(i, 3){ if(t1!=i+1)a1.pb(i+1); if(t2!=i+4)a2.pb(i+4); } int dist = 1; while(dist==t1||dist==t2)dist++; W[0] = getLightest(t1, t2, dist); if(t1==W[0]){ W[1] = getLightest(t2, a1[0], a1[1]); }else{ W[1] = getLightest(t1, a2[0], a2[1]); } vl left; fo(i, 6){ if(i+1==W[0] || i+1 == W[1]) continue; left.pb(i+1); } ll res = getLightest(left[0], left[1], left[2]); ll other = left[0]; if(other == res) other = left[1]; ll res2 = getMedian(res, other, left[3]); if(res2 == left[3]){ W[2] = res; left.clear(); fo(i, 6){ if(i+1==W[0] || i+1 == W[1] || i+1 == W[2]) continue; left.pb(i+1); } W[3] = getLightest(left[0], left[1], left[2]); W[4] = getMedian(left[0], left[1], left[2]); }else{ W[2] = res2; W[3] = res; W[4] = getMedian(left[0], left[1], left[2]); } fo(i, 6){ if(i+1==W[0] || i+1==W[1] || i+1==W[2] || i+1 == W[3]|| i+1 == W[4]) continue; W[5] = i+1; } answer(W); } int main(){ deb(1); return 0; }

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:36:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   36 |         W[1] = getLightest(t2, a1[0], a1[1]);
      |                                            ^
scales.cpp:36:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:39:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   39 |         W[1] = getLightest(t1, a2[0], a2[1]);
      |                                            ^
scales.cpp:39:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:47:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   47 |     ll res = getLightest(left[0], left[1], left[2]);
      |                                                   ^
scales.cpp:47:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:47:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:50:25: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   50 |     ll res2 = getMedian(res, other, left[3]);
      |                         ^~~
scales.cpp:50:30: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   50 |     ll res2 = getMedian(res, other, left[3]);
      |                              ^~~~~
scales.cpp:50:44: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   50 |     ll res2 = getMedian(res, other, left[3]);
      |                                            ^
scales.cpp:52:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   52 |         W[2] = res;
      |                ^~~
scales.cpp:58:53: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   58 |         W[3] = getLightest(left[0], left[1], left[2]);
      |                                                     ^
scales.cpp:58:53: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:58:53: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:59:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   59 |         W[4] = getMedian(left[0], left[1], left[2]);
      |                                                   ^
scales.cpp:59:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:59:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:63:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   63 |         W[2] = res2;
      |                ^~~~
scales.cpp:64:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   64 |         W[3] = res;
      |                ^~~
scales.cpp:65:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   65 |         W[4] = getMedian(left[0], left[1], left[2]);
      |                                                   ^
scales.cpp:65:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:65:51: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
scales.cpp:69:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   69 |         W[5] = i+1;
      |                ~^~
/usr/bin/ld: /tmp/ccWT4glW.o: in function `main':
scales.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccUORsKW.o:grader.c:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status