結果
問題 | No.1935 Water Simulation |
ユーザー | 3mEhsfd8aG5jx2t |
提出日時 | 2022-05-13 23:49:58 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,997 bytes |
コンパイル時間 | 2,252 ms |
コンパイル使用メモリ | 215,620 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-22 04:14:00 |
合計ジャッジ時間 | 3,187 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
5,248 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | WA | - |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 2 ms
5,376 KB |
testcase_14 | WA | - |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | WA | - |
testcase_18 | AC | 1 ms
5,376 KB |
testcase_19 | AC | 2 ms
5,376 KB |
testcase_20 | AC | 2 ms
5,376 KB |
testcase_21 | AC | 2 ms
5,376 KB |
testcase_22 | AC | 2 ms
5,376 KB |
testcase_23 | WA | - |
testcase_24 | AC | 2 ms
5,376 KB |
testcase_25 | WA | - |
testcase_26 | AC | 2 ms
5,376 KB |
testcase_27 | AC | 1 ms
5,376 KB |
testcase_28 | AC | 2 ms
5,376 KB |
testcase_29 | AC | 1 ms
5,376 KB |
testcase_30 | AC | 2 ms
5,376 KB |
testcase_31 | AC | 2 ms
5,376 KB |
ソースコード
#include <bits/stdc++.h> #define REP(i, n) for(long long i = 0; i < (long long)(n); i++) using ll = long long; using namespace std; struct S { int id = 0; ll v1, v2, v3, v4; S(ll mv1, ll mv2, ll mv3, ll mv4) : v1(mv1), v2(mv2), v3(mv3), v4(mv4) {} }; bool operator<(const S &l, const S &r) noexcept { if(l.v1 != r.v1) return l.v1 < r.v1; if(l.v2 != r.v2) return l.v2 < r.v2; if(l.v3 != r.v3) return l.v3 < r.v3; if(l.v4 != r.v4) return l.v4 < r.v4; return l.id < r.id; } int main() { ll v1, v2, v3, v4, N; cin >> v1 >> v2 >> v3 >> v4 >> N; map<S, ll> mp; set<S> s; S now(v1, 0, 0, 0); bool skip = false; REP(i, N) { now.id = i % 4; if(i % 4 == 0) { { // 1 ll add = v2 - now.v2; add = min(add, now.v1); now.v1 -= add, now.v2 += add; } } if(i % 4 == 1) { { // 2 ll add = v3 - now.v3; add = min(add, now.v2); now.v2 -= add, now.v3 += add; } } if(i % 4 == 2) { { // 3 ll add = v4 - now.v4; add = min(add, now.v3); now.v3 -= add, now.v4 += add; } } if(i % 4 == 3) { { // 1 ll add = v1 - now.v1; add = min(add, now.v4); now.v4 -= add, now.v1 += add; } } if(mp.count(now)) { cerr << "hoge" << endl; ll dist = i - mp[now]; ll remain = N - i; remain = (remain / dist) * dist; i += remain; skip = true; } cerr << i << endl; mp[now] = i; s.insert(now); } cerr << mp.size() << endl; cout << now.v1 << " " << now.v2 << " " << now.v3 << " " << now.v4 << endl; // printf("%lld %lld %lld %lld\n", now.v1, now.v2, now.v3, now.v4); }