結果

問題 No.2566 美しい整数列
ユーザー maeshunmaeshun
提出日時 2023-12-02 15:53:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 970 bytes
コンパイル時間 5,226 ms
コンパイル使用メモリ 269,256 KB
実行使用メモリ 20,480 KB
最終ジャッジ日時 2023-12-02 15:54:00
合計ジャッジ時間 11,516 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 325 ms
20,480 KB
testcase_05 AC 337 ms
20,480 KB
testcase_06 AC 209 ms
8,064 KB
testcase_07 AC 217 ms
8,064 KB
testcase_08 AC 211 ms
8,064 KB
testcase_09 AC 214 ms
8,064 KB
testcase_10 AC 213 ms
8,064 KB
testcase_11 AC 241 ms
11,136 KB
testcase_12 AC 270 ms
11,136 KB
testcase_13 AC 239 ms
11,136 KB
testcase_14 AC 243 ms
11,136 KB
testcase_15 AC 240 ms
11,136 KB
testcase_16 AC 280 ms
19,584 KB
testcase_17 AC 299 ms
19,840 KB
testcase_18 AC 303 ms
19,968 KB
testcase_19 AC 201 ms
14,464 KB
testcase_20 AC 265 ms
18,816 KB
testcase_21 AC 313 ms
19,200 KB
testcase_22 AC 185 ms
13,440 KB
testcase_23 AC 228 ms
17,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for(int i=0;i<(n);++i)
#define rep1(i, n) for(int i=1;i<=(n);i++)
#define ll long long
using mint = modint998244353;
using P = pair<ll,ll>;
using lb = long double;
using T = tuple<ll, ll, ll>;
#ifdef LOCAL
#  include <debug_print.hpp>
#  define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#  define dbg(...) (static_cast<void>(0))
#endif

int main()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n), b(m), c(n);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    rep(i,n) cin >> c[i];
    map<ll, ll> mp;
    ll now = 0;
    mp[a[0]-now] += c[0];
    for(int i=1;i<n;i++){
        now += b[(i-1)%m];
        mp[a[i]-now] += c[i];
    }
    ll sum = accumulate(c.begin(),c.end(),0ll);
    dbg(mp);
    dbg(sum);
    ll d = 0;
    for(auto p : mp){
        d = max(p.second, d);
    }
    cout << sum-d << endl;
    return 0;
}
0