結果

問題 No.1584 Stones around Circle Pond
ユーザー milanis48663220milanis48663220
提出日時 2021-07-02 23:39:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,800 bytes
コンパイル時間 840 ms
コンパイル使用メモリ 99,984 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-12 00:03:09
合計ジャッジ時間 2,975 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
4,380 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 2 ms
4,380 KB
testcase_47 WA -
testcase_48 AC 2 ms
4,376 KB
testcase_49 AC 2 ms
4,376 KB
testcase_50 AC 2 ms
4,380 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 1 ms
4,380 KB
testcase_56 AC 2 ms
4,380 KB
testcase_57 AC 2 ms
4,380 KB
testcase_58 AC 2 ms
4,376 KB
testcase_59 AC 1 ms
4,376 KB
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <numeric>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

const ll INF = 1e+15;

typedef pair<ll, int> P;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int n; ll l; cin >> n >> l;
    vector<ll> d(n);
    for(int i = 0; i < n; i++) cin >> d[i];
    vector<ll> b(2*n);
    for(int i = 0; i < 2*n; i++) cin >> b[i];
    ll b_sum = accumulate(b.begin(), b.end(), 0ll);
    for(int i = 0; i < n; i++){
        if((b[i]+b[i+n])*n != b_sum){
            cout << "No" << endl;
            return 0;
        }
    }
    ll D = b_sum/(l*n);
    vector<int> x(n-1);
    vector<int> y(n-1);
    for(int i = 0; i < n-1; i++){
        if((b[i]-b[i+1])%(d[i+1]-d[i]) != 0){
            cout << "No" << endl;
            return 0;
        }
        x[i] = (b[i]-b[i+1])/(d[i+1]-d[i]);
        if(D-x[i] < 0 || (D-x[i])%2 != 0){
            cout << "No" << endl;
            return 0;
        }
        y[i] = (D-x[i])/2;
    }
    vector<int> dd(2*n);
    dd[0] = 0;
    for(int i = 0; i < n-1; i++){
        dd[i+1] = dd[i]+max(0, y[i]-y[i+1]);
    }
    for(int i = 0; i < n-1; i++){
        dd[i+n] = dd[i]+y[i];
        if(dd[i+n] < dd[i+n-1]){
            cout << "No" << endl;
        }
    }
    cout << "Yes" << endl;
}
0