結果
問題 | No.2248 max(C)-min(C) |
ユーザー |
![]() |
提出日時 | 2023-03-04 02:40:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,888 bytes |
コンパイル時間 | 2,869 ms |
コンパイル使用メモリ | 200,036 KB |
最終ジャッジ日時 | 2025-02-11 05:05:01 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 TLE * 34 |
ソースコード
#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_100struct __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;}