Submission #551807

#TimeUsernameProblemLanguageResultExecution timeMemory
551807Theo830Scales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e9+7; const ll MOD = 998244353; typedef pair<ll,ll> ii; #define iii pair<ll,ii> #define f(i,a,b) for(ll i = a;i < b;i++) #define pb push_back #define vll vector<ll> #define F first #define S second #define all(x) (x).begin(), (x).end() ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst) ///Stay Calm ///Look for special cases ///Beware of overflow and array bounds ///Think the problem backwards ///Training void init(int T) { } void orderCoins() { int W[] = {1, 2, 3, 4, 5, 6}; vector<int>ex[2]; ex[0].pb(getLightest(1,2,3)); ex[0].pb(getMedian(1,2,3)); set<ll>e; f(i,0,3){ e.insert(i+1); } for(auto x:ex[0]){ e.erase(x); } ex[0].pb((*e.begin())); ex[1].pb(getLightest(4,5,6)); ex[1].pb(getMedian(4,5,6)); set<ll>e; f(i,3,6){ e.insert(i+1); } for(auto x:ex[1]){ e.erase(x); } ex[1].pb((*e.begin())); f(i,0,6){ if(ex[0].empty()){ W[i] = ex[1][0]; ex[1].erase(ex[1].begin()); } else if(ex[1].empty()){ W[i] = ex[0][0]; ex[0].erase(ex[0].begin()); } else{ if((ll)(ex[0].size() + ex[1].size()) == 2){ W[i] = getMedian(ex[0][0],ex[1][0],W[i-1]); } else{ ll v; if(ex[0].size() > 1){ v = ex[0][1]; } else{ v = ex[1][1]; } W[i] = getLightest(ex[0][0],ex[1][0],v); } if(W[i] == ex[0][0]){ ex[0].erase(ex[0].begin()); } else{ ex[1].erase(ex[1].begin()); } } } answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:25:15: warning: unused parameter 'T' [-Wunused-parameter]
   25 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:31:14: error: 'getLightest' was not declared in this scope
   31 |     ex[0].pb(getLightest(1,2,3));
      |              ^~~~~~~~~~~
scales.cpp:32:14: error: 'getMedian' was not declared in this scope
   32 |     ex[0].pb(getMedian(1,2,3));
      |              ^~~~~~~~~
scales.cpp:40:15: warning: conversion from 'long long int' to 'std::vector<int>::value_type' {aka 'int'} may change value [-Wconversion]
   40 |     ex[0].pb((*e.begin()));
      |              ~^~~~~~~~~~~
scales.cpp:43:12: error: redeclaration of 'std::set<long long int> e'
   43 |     set<ll>e;
      |            ^
scales.cpp:33:12: note: 'std::set<long long int> e' previously declared here
   33 |     set<ll>e;
      |            ^
scales.cpp:50:15: warning: conversion from 'long long int' to 'std::vector<int>::value_type' {aka 'int'} may change value [-Wconversion]
   50 |     ex[1].pb((*e.begin()));
      |              ~^~~~~~~~~~~
scales.cpp:82:5: error: 'answer' was not declared in this scope
   82 |     answer(W);
      |     ^~~~~~