제출 #551997

#제출 시각아이디문제언어결과실행 시간메모리
551997Theo830저울 (IOI15_scales)C++17
컴파일 에러
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 #include "scales.h" void init(int T) { } void orderCoins() { int W[] = {1, 2, 3, 4, 5, 6}; vector<int>ex[2]; ex[0].pb(getHeaviest(1,2,3)); set<ll>e; f(i,0,3){ e.insert(i+1); } e.erase(ex[0].back()); for(auto x:e){ ex[0].insert(ex[0].begin(),x); } ex[1].pb(getHeaviest(4,5,6)); e.clear(); f(i,3,6){ e.insert(i+1); } e.erase(ex[1].back()); for(auto x:e){ ex[1].insert(ex[1].begin(),x); } W[5] = getHeaviest(ex[1].back(),ex[0].back(),ex[1][1]); if(W[5] != ex[1].back()){ swap(ex[0],ex[1]); } ll p = getNextLightest(ex[1][0],ex[1][1],ex[1][2],ex[0][1]); if(p == ex[1][2]){ W[4] = ex[0][2]; W[3] = ex[0][1]; W[0] = getLightest(ex[0][0],ex[1][1],ex[1][0]); W[1] = getMedian(ex[0][0],ex[1][1],ex[1][0]); set<ll>e; e.insert(ex[0][0]); e.insert(ex[1][1]); e.insert(ex[1][0]); e.erase(W[0]); e.erase(W[1]); W[2] = (*e.begin()); } else{ ll o = ex[1][0] + ex[1][1] - p; ll p2 = getNextLightest(ex[0][0],ex[0][1],W[5],o); if(p2 == ex[0][0]){ W[0] = o; W[1] = ex[0][0]; W[2] = ex[0][1]; W[3] = getLighter(ex[0][2],p,W[5]); W[4] = ex[0][2] + p - W[3]; } else if(p2 == ex[0][1]){ W[0] = ex[0][0]; W[1] = o; W[2] = ex[0][1]; W[3] = getLighter(ex[0][2],p,W[5]); W[4] = ex[0][2] + p - W[3]; } else{ W[0] = ex[0][0]; W[1] = ex[0][1]; W[3] = getMedian(ex[0][2],o,p); if(W[3] == p){ W[4] = o; W[2] = ex[0][2]; } else if(W[3] == o){ W[2] = p; W[4] = ex[0][2]; } else{ W[2] = p; W[4] = o; } } } 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:39:36: warning: conversion from 'long long int' to 'std::vector<int>::value_type' {aka 'int'} may change value [-Wconversion]
   39 |         ex[0].insert(ex[0].begin(),x);
      |                                    ^
scales.cpp:48:36: warning: conversion from 'long long int' to 'std::vector<int>::value_type' {aka 'int'} may change value [-Wconversion]
   48 |         ex[1].insert(ex[1].begin(),x);
      |                                    ^
scales.cpp:60:16: warning: declaration of 'e' shadows a previous local [-Wshadow]
   60 |         set<ll>e;
      |                ^
scales.cpp:33:12: note: shadowed declaration is here
   33 |     set<ll>e;
      |            ^
scales.cpp:66:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   66 |         W[2] = (*e.begin());
      |                ~^~~~~~~~~~~
scales.cpp:70:56: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   70 |         ll p2 = getNextLightest(ex[0][0],ex[0][1],W[5],o);
      |                                                        ^
scales.cpp:72:20: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   72 |             W[0] = o;
      |                    ^
scales.cpp:75:20: error: 'getLighter' was not declared in this scope; did you mean 'getLightest'?
   75 |             W[3] = getLighter(ex[0][2],p,W[5]);
      |                    ^~~~~~~~~~
      |                    getLightest
scales.cpp:76:33: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   76 |             W[4] = ex[0][2] + p - W[3];
scales.cpp:80:20: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   80 |             W[1] = o;
      |                    ^
scales.cpp:82:20: error: 'getLighter' was not declared in this scope; did you mean 'getLightest'?
   82 |             W[3] = getLighter(ex[0][2],p,W[5]);
      |                    ^~~~~~~~~~
      |                    getLightest
scales.cpp:83:33: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   83 |             W[4] = ex[0][2] + p - W[3];
scales.cpp:88:39: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   88 |             W[3] = getMedian(ex[0][2],o,p);
      |                                       ^
scales.cpp:88:41: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   88 |             W[3] = getMedian(ex[0][2],o,p);
      |                                         ^
scales.cpp:90:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   90 |                 W[4] = o;
      |                        ^
scales.cpp:94:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   94 |                 W[2] = p;
      |                        ^
scales.cpp:98:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   98 |                 W[2] = p;
      |                        ^
scales.cpp:99:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   99 |                 W[4] = o;
      |                        ^