제출 #551999

#제출 시각아이디문제언어결과실행 시간메모리
551999Theo830저울 (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]); W[2] = ex[0][0 + ex[1][1] + ex[1][0] - W[0] - W[1]; } 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] = getLightest(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] = getLightest(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:59: error: expected ']' before ';' token
   60 |         W[2] = ex[0][0 + ex[1][1] + ex[1][0] - W[0] - W[1];
      |                                                           ^
      |                                                           ]
scales.cpp:64:56: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   64 |         ll p2 = getNextLightest(ex[0][0],ex[0][1],W[5],o);
      |                                                        ^
scales.cpp:66:20: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   66 |             W[0] = o;
      |                    ^
scales.cpp:69:41: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   69 |             W[3] = getLightest(ex[0][2],p,W[5]);
      |                                         ^
scales.cpp:70:33: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   70 |             W[4] = ex[0][2] + p - W[3];
scales.cpp:74:20: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   74 |             W[1] = o;
      |                    ^
scales.cpp:76:41: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   76 |             W[3] = getLightest(ex[0][2],p,W[5]);
      |                                         ^
scales.cpp:77:33: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   77 |             W[4] = ex[0][2] + p - W[3];
scales.cpp:82:39: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   82 |             W[3] = getMedian(ex[0][2],o,p);
      |                                       ^
scales.cpp:82:41: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   82 |             W[3] = getMedian(ex[0][2],o,p);
      |                                         ^
scales.cpp:84:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   84 |                 W[4] = o;
      |                        ^
scales.cpp:88:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   88 |                 W[2] = p;
      |                        ^
scales.cpp:92:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   92 |                 W[2] = p;
      |                        ^
scales.cpp:93:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   93 |                 W[4] = o;
      |                        ^