結果

問題 No.2566 美しい整数列
ユーザー ragnaragna
提出日時 2023-09-27 23:54:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 316 ms / 2,000 ms
コード長 1,021 bytes
コンパイル時間 2,114 ms
コンパイル使用メモリ 173,984 KB
実行使用メモリ 20,280 KB
最終ジャッジ日時 2023-09-27 23:54:11
合計ジャッジ時間 11,213 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 283 ms
20,280 KB
testcase_05 AC 316 ms
20,164 KB
testcase_06 AC 188 ms
7,756 KB
testcase_07 AC 190 ms
7,756 KB
testcase_08 AC 183 ms
7,864 KB
testcase_09 AC 193 ms
7,800 KB
testcase_10 AC 190 ms
7,872 KB
testcase_11 AC 229 ms
11,096 KB
testcase_12 AC 205 ms
10,888 KB
testcase_13 AC 209 ms
11,092 KB
testcase_14 AC 208 ms
10,884 KB
testcase_15 AC 208 ms
10,924 KB
testcase_16 AC 248 ms
19,536 KB
testcase_17 AC 242 ms
19,696 KB
testcase_18 AC 257 ms
19,804 KB
testcase_19 AC 166 ms
14,388 KB
testcase_20 AC 233 ms
18,416 KB
testcase_21 AC 248 ms
18,800 KB
testcase_22 AC 150 ms
13,292 KB
testcase_23 AC 198 ms
16,988 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:31:16: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   31 |     for(auto&& [k,l]:mp){
      |                ^

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrep(i,a,b) for(ll i=(ll)(a-1);i>=(ll)(b);i--)
#define MOD 998244353
//#define MOD 1000000007
#define INF 1e18
#define Pair pair<ll,ll>
//#define PI numbers::pi
//#define E numbers::e
template <typename T> bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
ll dx[8]={-2,-1,1,2,-2,-1,1,2};
ll dy[8]={-1,-2,-2,-1,1,2,2,1};

int main(){
    ll n,m; cin >> n >> m;
    vector<ll> a(n),b(m),c(n);
    rep(i,0,n) cin >> a[i];
    rep(i,0,m) cin >> b[i];
    rep(i,0,n) cin >> c[i];
    map<ll,ll> mp;
    ll d=0,sum=0;
    rep(i,0,n) sum+=c[i];
    rep(i,1,n){
        d+=b[(i-1)%m];
        mp[a[i]-d]+=c[i];
    }
    ll ans=INF;
    for(auto&& [k,l]:mp){
        if(a[0]==k) chmin(ans,sum-l-c[0]);
        else chmin(ans,sum-l);
    }
    cout << ans << endl;
    //for(auto&& [k,l]:mp) cout << k << ' ' << l << endl;
}
0