結果

問題 No.2566 美しい整数列
ユーザー umezoumezo
提出日時 2023-12-02 16:17:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 2,232 ms
コンパイル使用メモリ 210,992 KB
実行使用メモリ 22,144 KB
最終ジャッジ日時 2023-12-02 16:17:25
合計ジャッジ時間 6,041 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 123 ms
22,144 KB
testcase_05 AC 127 ms
22,144 KB
testcase_06 AC 61 ms
9,600 KB
testcase_07 AC 69 ms
9,600 KB
testcase_08 AC 64 ms
9,600 KB
testcase_09 AC 65 ms
9,600 KB
testcase_10 AC 65 ms
9,600 KB
testcase_11 AC 84 ms
12,800 KB
testcase_12 AC 82 ms
12,800 KB
testcase_13 AC 93 ms
12,800 KB
testcase_14 AC 87 ms
12,800 KB
testcase_15 AC 83 ms
12,800 KB
testcase_16 AC 111 ms
21,248 KB
testcase_17 AC 120 ms
21,504 KB
testcase_18 AC 125 ms
21,632 KB
testcase_19 AC 79 ms
15,488 KB
testcase_20 AC 111 ms
20,224 KB
testcase_21 AC 113 ms
20,736 KB
testcase_22 AC 72 ms
14,464 KB
testcase_23 AC 93 ms
18,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n,m;
  cin>>n>>m;
  vector<ll> A(n),B(m),C(n);
  ll sum=0;
  rep(i,n) cin>>A[i];
  rep(i,m) cin>>B[i];
  rep(i,n){
    cin>>C[i];
    sum+=C[i];
  }
  vector<ll> S(n);
  for(int i=1;i<n;i++) S[i]=S[i-1]+B[(i-1)%m];
  map<ll,ll> ma;
  rep(i,n){
    ma[A[i]-S[i]]+=C[i];
  }
  ll t=0;
  for(auto [a,b]:ma){
    t=max(t,b);
  }
  cout<<sum-t<<endl;
    
  return 0;
}
0