結果
問題 | No.813 ユキちゃんの冒険 |
ユーザー |
|
提出日時 | 2019-04-12 23:21:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,225 bytes |
コンパイル時間 | 1,486 ms |
コンパイル使用メモリ | 163,632 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-01-02 03:52:10 |
合計ジャッジ時間 | 51,062 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 23 |
ソースコード
#include"bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; #define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++) #define REP(i,n) FOR((i),0,(n)) #define WAITING(str) int str;std::cin>>str; #define DEBUGING(str) cout<< #str << " " str<<endl constexpr int INF = (1 << 30); constexpr ll INFL = (1ll << 60); constexpr ll MOD = 1000000007;// 10^9+7 int N; ld p, q, dead; vector<ld> nowv, nextv; using namespace chrono; int main() { auto start = system_clock::now(); cin >> N >> p >> q; nowv = vector<ld>(N + 2); nextv = vector<ld>(N + 2); nowv[1] = 1; REP(i, 1e9) { fill(nextv.begin(), nextv.end(), 0); FOR(j, 1, N) { nextv[j - 1] += p * nowv[j]; nextv[j + 1] += q * nowv[j]; dead += (1 - p - q)*nowv[j]; } FOR(j, 1, N + 1)nowv[j] = nextv[j]; nowv[0] += nextv[0]; nowv[N + 1] += nextv[N + 1]; if (i % 1000 == 0) { auto now = system_clock::now(); auto dur = duration_cast<milliseconds>(now - start).count(); //cerr << dur << endl; if (dur > 1800) { break; } } } cout << nowv.front(); //cout << "back: " << nowv.front() << " go:" << nowv.back() << " dead:" << dead << endl; return 0; }