제출 #551809

#제출 시각아이디문제언어결과실행 시간메모리
551809Theo830저울 (IOI15_scales)C++17
45.45 / 100
1 ms304 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 #include "scales.h" 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); } auto it = e.begin(); ex[0].pb((*it)); ex[1].pb(getLightest(4,5,6)); ex[1].pb(getMedian(4,5,6)); e.clear(); f(i,3,6){ e.insert(i+1); } for(auto x:ex[1]){ e.erase(x); } it = e.begin(); ex[1].pb((*it)); 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); }

컴파일 시 표준 에러 (stderr) 메시지

scales.cpp: In function 'void init(int)':
scales.cpp:26:15: warning: unused parameter 'T' [-Wunused-parameter]
   26 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:42:15: warning: conversion from 'long long int' to 'std::vector<int>::value_type' {aka 'int'} may change value [-Wconversion]
   42 |     ex[0].pb((*it));
      |              ~^~~~
scales.cpp:53:15: warning: conversion from 'long long int' to 'std::vector<int>::value_type' {aka 'int'} may change value [-Wconversion]
   53 |     ex[1].pb((*it));
      |              ~^~~~
scales.cpp:75:54: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   75 |                 W[i] = getLightest(ex[0][0],ex[1][0],v);
      |                                                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...