結果
| 問題 |
No.1935 Water Simulation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-13 22:41:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 728 bytes |
| コンパイル時間 | 1,653 ms |
| コンパイル使用メモリ | 180,568 KB |
| 実行使用メモリ | 13,756 KB |
| 最終ジャッジ日時 | 2024-07-22 02:51:11 |
| 合計ジャッジ時間 | 5,118 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 1 WA * 4 TLE * 1 -- * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for (int i=0;i<(int)(n);i++)
vector<int> v(4);
vector<int> dd(4,0);
void mv(int x){
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(){
rep(i,4) cin>>v.at(i);
ll n;
cin>>n;
ll cn=0;
dd.at(0)=v.at(0);
vector<map<vector<int>,int>> st(4);
st.at(3)[dd]=-1;
rep(i,n){
// for(auto k:dd)cout<<k<<" ";
// cout<<endl;
mv(i%4);
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)));
else st.at(i%4)[dd]=i;
}
for(auto k:dd)cout<<k<<" ";
cout<<endl;
}