結果
| 問題 | No.1935 Water Simulation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-13 23:19:38 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 737 bytes |
| 記録 | |
| コンパイル時間 | 1,999 ms |
| コンパイル使用メモリ | 195,544 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-04-03 07:14:42 |
| 合計ジャッジ時間 | 7,356 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 13 RE * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for (int i=0;i<(int)(n);i++)
void mv(int x,vector<int> &v,vector<int> &dd){
int cmv=v.at((x+1)%4)-dd.at((x+1)%4);
if(dd.at(x)>cmv){
dd.at((x+1)%4)=v.at((x+1)%4);
dd.at(x)-=cmv;
}else{
dd.at((x+1)%4)+=dd.at(x);
dd.at(x)=0;
}
}
int main(){
vector<int> v(4);
vector<int> dd(4,0);
rep(i,4) cin>>v.at(i);
ll n;
cin>>n;
dd.at(0)=v.at(0);
vector<map<vector<int>,int>> st(4);
st.at(3)[dd]=-1;
rep(i,n){
mv(i%4,v,dd);
if(st.at(i%4).count(dd)) i+=(i-st.at(i%4).at(dd))*((n-i-1)/(i-st.at(i%4).at(dd)));
st.at(i%4)[dd]=i;
}
rep(i,4) {
cout<<dd.at(i);
if(i!=3) cout<<" ";
else cout<<endl;
}
}