結果

問題 No.909 たぴの配置
ユーザー ysystem7ysystem7
提出日時 2020-10-16 21:08:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 60 ms / 3,000 ms
コード長 1,574 bytes
コンパイル時間 2,515 ms
コンパイル使用メモリ 211,296 KB
実行使用メモリ 6,316 KB
最終ジャッジ日時 2023-09-28 02:30:46
合計ジャッジ時間 6,647 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 57 ms
6,316 KB
testcase_06 AC 58 ms
6,176 KB
testcase_07 AC 56 ms
5,900 KB
testcase_08 AC 57 ms
5,908 KB
testcase_09 AC 60 ms
6,236 KB
testcase_10 AC 53 ms
5,856 KB
testcase_11 AC 55 ms
5,852 KB
testcase_12 AC 55 ms
5,904 KB
testcase_13 AC 59 ms
6,240 KB
testcase_14 AC 54 ms
5,880 KB
testcase_15 AC 55 ms
5,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
//#define mod 998244353
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline void out(T a){ cout << a << '\n'; }
//void YN(bool ok){if(ok) cout << "Yes" << endl; else cout << "No" << endl;}
void YN(bool ok){if(ok) cout << "YES" << endl; else cout << "NO" << endl;}


const ll INF=1e18;
const int mx=200005;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    V<ll> x(n),y(n);
    cinf(n,x);
    cinf(n,y);
    ll l=0,r=INF+1;
    while(r-l>1){
        ll mid=(r+l)/2;
        bool ok=1;
        rep(i,n){
            if(x[i]+y[i]<mid) ok=0;
        }
        if(ok) l=mid;
        else r=mid;
    }
    out(l);
    out(0);
    rep(i,n){
        ll ans=x[i];
        if(ans>l) ans=l;
        out(ans);
    }
    out(l);
}
0