結果

問題 No.2566 美しい整数列
ユーザー マベマス(mavemas_413)マベマス(mavemas_413)
提出日時 2023-11-28 15:33:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,603 bytes
コンパイル時間 3,985 ms
コンパイル使用メモリ 229,716 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2024-09-26 12:58:36
合計ジャッジ時間 11,315 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
// long long
using ll = long long;
// unsigned long long 
using ull = unsigned long long;
// string 
using str = string;
// long double
using ld = long double;
// pair 
using pll = pair < ll, ll >;
// tuple
using tlll = tuple < ll, ll, ll >;
// vector
template < class T > using v = vector < T >;
using vl = v < ll >;
using vbl = v < bool >;
// priority_queue 
template < class T > using pq = priority_queue < T >;
template < class T > using pqg = priority_queue < T, v < T >, greater < T > >;
// unordered_set
template < class T > using uset = unordered_set < T > ;
// unordered_map
template < class T, class U > using umap = unordered_map < T, U > ;
// rep
#define rep(i, a, b) for(ll i = a; i <= b; i ++)
#define Rep(i, a) for(ll i = 0; i < a; i ++)
#define rrep(i, a, b) for(ll i = a; i >= b; i --)
#define repp(i, a, b, c) for(ll i = a; i <= b; i += c)
// binary search
#define lobo(x, k) lower_bound(x.begin(), x.end(), k) - x.begin()
#define Lobo(x, a, b, k) lower_bound(x + a, x + b + 1, k) - x
#define upbo(x, k) upper_bound(x.begin(), x.end(), k) - x.begin()
#define Upbo(x, a, b, k) upper_bound(x + a, x + b + 1, k) - x;
// snippet
#define eruni(x) x.erase(unique(x.begin(), x.end()), x.end())
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) x.begin(), x.end()
#define rll(x) x.rbegin(), x.rend()
#define sz(x) (ll)x.size()
#define f first 
#define s second 
#define in insert
#define pf push_front
#define p_f pop_front
#define pb push_back
#define p_b pop_back
#define p_p prev_permutation
#define n_p next_permutation
#define led leader
#define print(a) printf("%.20Lf", a)
#define func function
// function
template < class T > bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template < class T > bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
// out
void Yes(bool f = true) {cout << (f ? "Yes" : "No" ) << endl;}
void No(bool f = true) {cout << (f ? "No" : "Yes" ) << endl;}
void YES(bool f = true) {cout << (f ? "YES" : "NO" ) << endl;}
void NO(bool f = true) {cout << (f ? "NO" : "YES" ) << endl;}
template < class T > void out(T a) {cout << a << endl;}
template < class T > void out1(T a) {cout << a << " ";}
template < class T, class U > void out2(T a, U b) {cout << a << " " << b << endl;}
template < class T> void allout(T &a) {
   for(auto x : a) cout << x << " ";
   cout << endl;
}
template < class T > void allout1(T &a) {
   for(auto x : a) cout << x << endl;
}

// modint
using modi = modint998244353;
using mint = modint1000000007;
// constant
const ll md = 998244353;
const ll mo = 1000000007;
const ld pi = acos(-1);
const ll inf = (1LL << 60);
const ll n1 = 100009;
const ll n2 = 200009;
const ll n3 = 300009;
const ll n5 = 500009;
// grid
const pll ar1[4] = { {0, 0}, {1, 0}, {0, 1}, {1, 1} };
const pll ar2[4] = { {-1, 0}, {0, -1}, {1, 0}, {0, 1} };
const pll ar3[8] = { {-1, 0}, {0, -1}, {1, 0}, {0, 1}, {-1, 1}, {1, -1}, {1, 1}, {-1, -1} };

int main(){
   ll n, m;
   cin >> n >> m;
   vl A(n), B(m), C(n), X(n);
   Rep(i, n) {
      cin >> X[i];
      A[i] = X[i];
   }
   Rep(i, m) cin >> B[i];
   Rep(i, n) cin >> C[i];
   ll c1 = 0, c2 = 0;
   rep(i, 0, n - 2){
      if(A[i + 1] - A[i] != B[i % m]){
         c1 += C[i + 1];
         A[i + 1] = A[i] + B[i % m];
      }
   }
   Rep(i, n) A[i] = X[i];
   rrep(i, n - 1, 1){
      if(A[i] - A[i - 1] != B[(i - 1) % m]){
         c2 += C[i - 1];
         A[i - 1] = A[i] - B[(i - 1) % m];
      }
   }
   ll ans = min(c1, c2);
   out(ans);
}
0