結果

問題 No.909 たぴの配置
ユーザー suika_psuika_p
提出日時 2019-10-18 22:10:07
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 298 ms / 3,000 ms
コード長 1,597 bytes
コンパイル時間 1,495 ms
コンパイル使用メモリ 167,340 KB
実行使用メモリ 7,804 KB
最終ジャッジ日時 2023-09-07 23:38:26
合計ジャッジ時間 8,013 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 298 ms
7,568 KB
testcase_06 AC 297 ms
7,796 KB
testcase_07 AC 267 ms
7,268 KB
testcase_08 AC 269 ms
7,804 KB
testcase_09 AC 285 ms
7,796 KB
testcase_10 AC 256 ms
7,260 KB
testcase_11 AC 258 ms
7,252 KB
testcase_12 AC 272 ms
7,500 KB
testcase_13 AC 290 ms
7,796 KB
testcase_14 AC 261 ms
7,312 KB
testcase_15 AC 268 ms
7,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N; cin >> N;
    vector<ll> X(N), Y(N);
    rep(i, N) cin >> X[i];
    rep(i, N) cin >> Y[i];
    ll ans = INF;
    int x, y;
    rep(i, N) {
        if (ans > X[i] + Y[i]) {
            ans = X[i] + Y[i];
            x = X[i];
            y = X[i] + Y[i];
        }
    }
    cout << ans << endl;
    vector<ll> p(N+2);
    p[0] = 1e9;
    p[N+1] = ans + 1e9;
    REPS(i, 1, N) {
        if (X[i-1] < Y[i-1]) {
            p[i] = X[i-1] + 1e9;
        } else {
            p[i] = ans + 1e9 - Y[i-1];
        }
    }
    rep(i, N+2) {
        cout << p[i] << endl;
    }
    return 0;
}
0