結果
問題 | No.1584 Stones around Circle Pond |
ユーザー | 👑 Nachia |
提出日時 | 2021-07-02 22:42:35 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,706 bytes |
コンパイル時間 | 641 ms |
コンパイル使用メモリ | 81,104 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-29 12:34:28 |
合計ジャッジ時間 | 1,978 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,940 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 | 1 ms
6,944 KB |
testcase_17 | WA | - |
testcase_18 | AC | 2 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,944 KB |
testcase_20 | AC | 1 ms
6,944 KB |
testcase_21 | AC | 2 ms
6,940 KB |
testcase_22 | AC | 2 ms
6,944 KB |
testcase_23 | AC | 1 ms
6,940 KB |
testcase_24 | AC | 1 ms
6,944 KB |
testcase_25 | AC | 2 ms
6,940 KB |
testcase_26 | AC | 1 ms
6,940 KB |
testcase_27 | AC | 2 ms
6,940 KB |
testcase_28 | AC | 2 ms
6,940 KB |
testcase_29 | AC | 2 ms
6,940 KB |
testcase_30 | AC | 2 ms
6,940 KB |
testcase_31 | AC | 1 ms
6,944 KB |
testcase_32 | AC | 2 ms
6,944 KB |
testcase_33 | AC | 1 ms
6,940 KB |
testcase_34 | AC | 1 ms
6,944 KB |
testcase_35 | AC | 2 ms
6,940 KB |
testcase_36 | AC | 1 ms
6,944 KB |
testcase_37 | AC | 2 ms
6,940 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
6,940 KB |
testcase_47 | WA | - |
testcase_48 | AC | 2 ms
6,940 KB |
testcase_49 | AC | 1 ms
6,940 KB |
testcase_50 | AC | 2 ms
6,944 KB |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; using ll = long long; using ull = unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) ll N,L; vector<ll> A; vector<ll> B; vector<ll> S; vector<ll> Cnt; vector<ll> DistSum; ll minvec(const vector<ll>& v){ ll x = v[0]; for(ll a : v) x = min(x,a); return x; } ll dist(ll a, ll b){ if(a > b) swap(a,b); return min(A[b]-A[a],A[a]-A[b]+2*L); } int main(){ cin >> N >> L; A.resize(2*N); rep(i,N) cin >> A[i]; rep(i,N) A[i+N] = A[i] + L; A.push_back(L*2+A[0]); B.resize(2*N); rep(i,2*N) cin >> B[i]; B.push_back(B[0]); S.resize(2*N); rep(i,2*N){ if(abs(B[i+1] - B[i]) % abs(A[i+1] - A[i]) != 0){ cout << "No\n"; return 0; } S[i] = - (B[i+1] - B[i]) / (A[i+1] - A[i]); } DistSum.assign(2*N,0); rep(i,2*N) rep(j,2*N) DistSum[i] += dist(i,j); Cnt.assign(2*N+1,0); Cnt[0] = S[2+N-1]; rep(i,2*N) Cnt[i+1] = Cnt[i] + S[i]; //rep(i,2*N) cout << Cnt[i] << " "; cout << endl; ll CntDiff = Cnt[N] + Cnt[0]; rep(i,N) if(Cnt[i] + Cnt[i+N] != CntDiff){ cout << "No\n"; return 0; } if(CntDiff % 2 != 0){ cout << "No\n"; return 0; } rep(i,2*N) Cnt[i] -= CntDiff / 2; //rep(i,2*N) cout << Cnt[i] << " "; cout << endl; rep(i,2*N) rep(j,2*N) if(Cnt[j] >= 0) B[i] -= Cnt[j] * dist(i,j); //rep(i,2*N) cout << B[i] << " "; cout << endl; rep(i,2*N) if(B[i] < 0){ cout << "No\n"; return 0; } rep(i,2*N-1) if(B[i] != B[i+1]){ cout << "No\n"; return 0; } if(B[0] % L != 0){ cout << "No\n"; return 0; } cout << "Yes\n"; return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ ios::sync_with_stdio(false); cin.tie(nullptr); } } ios_do_not_sync_inst;