結果

問題 No.484 収穫
ユーザー tubo28tubo28
提出日時 2017-02-10 23:36:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,363 bytes
コンパイル時間 1,435 ms
コンパイル使用メモリ 168,096 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-28 09:22:23
合計ジャッジ時間 4,245 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= int(a); --i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, int(n) + 1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
template<typename T> void __dump__(const T &first){ std::cerr << first << std::endl; }
template<typename First, typename... Rest>
void __dump__(const First& first, const Rest&... rest) { std::cerr << first << ", "; __dump__(rest...); }
#define dump(...) { std::cerr << __LINE__ << ":\t" #__VA_ARGS__ " = "; __dump__(__VA_ARGS__); }

#define int ll

int n;
vector<int> a;

signed main(){
    while(cin >> n){
        a.resize(n);
        rep(i, n) cin >> a[i];
        assert(n < 16);
        int ans = 1e18;
        rep(_, 2){
            rep(i, n){
                // dump(i);
                int pos = i;
                int time = a[pos];
                rep(j, n - 1){
                    int npos = (pos + 1) % n;
                    time = max(time + abs(pos - npos), a[npos]);
                    pos = npos;
                    // dump(time);
                }
                ans = min(ans, time);
            }
            reverse(all(a));
        }
        cout << ans << endl;
    }
}
0