結果

問題 No.2248 max(C)-min(C)
ユーザー bayashikobayashiko
提出日時 2023-03-04 02:40:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,888 bytes
コンパイル時間 4,782 ms
コンパイル使用メモリ 202,972 KB
実行使用メモリ 11,088 KB
最終ジャッジ日時 2023-10-18 05:18:09
合計ジャッジ時間 11,364 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 11 ms
4,348 KB
testcase_04 AC 6 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 38 ms
4,348 KB
testcase_07 AC 51 ms
4,348 KB
testcase_08 AC 52 ms
4,348 KB
testcase_09 AC 50 ms
4,348 KB
testcase_10 AC 3 ms
4,348 KB
testcase_11 AC 51 ms
4,348 KB
testcase_12 AC 13 ms
4,348 KB
testcase_13 AC 25 ms
4,348 KB
testcase_14 AC 52 ms
4,348 KB
testcase_15 AC 51 ms
4,348 KB
testcase_16 AC 10 ms
4,348 KB
testcase_17 AC 44 ms
4,348 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
//#define INF (1<<30)
//#define LINF (lint)(1LL<<56)
#define MINF (lint)(2e18)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define flc(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
#define all(x) x.begin(),x.end()
//#define vec vector<lint>
#define nep(x) next_permutation(all(x))
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=3e5+5;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//vector<int> bucket[MAX_N/1000];
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
//typedef __int128_t llint;
//#include<atcoder/all>
//using namespace atcoder;

int main(void){
    int N;
    cin >> N;
    int A[N],B[N];
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N) if(A[i]>B[i]) swap(A[i],B[i]);
    int C[N][3];
    rep(i,N) C[i][0]=A[i],C[i][1]=(A[i]+B[i])/2,C[i][2]=B[i];
    int ans=2e9;
    rep(i,N) rep(j,3){
        int mini=C[i][j];
        int maxi=C[i][j];
        rep(k,N){
            int take=2e9;
            rep(l,3) if(C[k][l]>=mini) chmin(take,C[k][l]);
            chmax(maxi,take);
        }
        chmin(ans,maxi-mini);
    }
    cout << ans << endl;
}
0