結果
問題 | No.2874 Gunegune Tree |
ユーザー |
![]() |
提出日時 | 2024-09-06 21:46:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,037 ms / 2,000 ms |
コード長 | 2,641 bytes |
コンパイル時間 | 7,000 ms |
コンパイル使用メモリ | 293,540 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-06 21:47:12 |
合計ジャッジ時間 | 21,545 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:86:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 86 | auto [a,b]=v[i]; | ^
ソースコード
// g++-13 1.cpp -std=c++17 -O2 -I .#include <bits/stdc++.h>using namespace std;#pragma GCC optimize("O3")#pragma GCC optimize("unroll-loops")#include<ext/pb_ds/assoc_container.hpp>#include<ext/pb_ds/tree_policy.hpp>#include<ext/pb_ds/tag_and_trait.hpp>using namespace __gnu_pbds;#include <atcoder/all>using namespace atcoder;using ll = long long;using ld = long double;using vi = vector<int>;using vvi = vector<vi>;using vll = vector<ll>;using vvll = vector<vll>;using vld = vector<ld>;using vvld = vector<vld>;using vst = vector<string>;using vvst = vector<vst>;#define fi first#define se second#define pb push_back#define eb emplace_back#define pq_big(T) priority_queue<T,vector<T>,less<T>>#define pq_small(T) priority_queue<T,vector<T>,greater<T>>#define all(a) a.begin(),a.end()#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())using mint = modint998244353;random_device seed;mt19937_64 randint(seed());ll grr(ll mi, ll ma) { // [mi, ma)return mi + randint() % (ma - mi);}// [その方向に最後に伸びる確率, 高さの期待値]vector<pair<mint,mint>> nxt(vector<pair<mint,mint>> &now){vector<pair<mint,mint>> res(5);res[0]={now[0].first/2+now[1].first/3,now[0].second*now[0].first/2+now[1].second*now[1].first/3};res[1]={now[0].first/2+now[1].first/3+now[2].first/3,(now[0].second*now[0].first)/2+(now[1].second*now[1].first)/3+(now[2].second*now[2].first)/3+1};res[2]={now[1].first/3+now[2].first/3+now[3].first/3,now[1].second*now[1].first/3+now[2].second*now[2].first/3+now[3].second*now[3].first/3+1};res[0]={now[0].first/2+now[1].first/3,now[0].second/2+now[1].second/3};res[1]={now[0].first/2+now[1].first/3+now[2].first/3,(now[0].second)/2+(now[1].second)/3+(now[2].second)/3+now[0].first/2+now[1].first/3+now[2].first/3};res[2]={now[1].first/3+now[2].first/3+now[3].first/3,now[1].second/3+now[2].second/3+now[3].second/3+now[1].first/3+now[2].first/3+now[3].first/3};res[3]=res[1];res[4]=res[0];// rep(i,0,5){// res[i].second/=res[i].first;// }return res;}int main(){ios::sync_with_stdio(false);cin.tie(nullptr);int n;cin>>n;vector<pair<mint,mint>> v(5);rep(i,0,5){v[i].first=1;v[i].first/=5;v[i].second=1;if(i==0||i==4)v[i].second=0;v[i].second/=5;}rep(i,0,n-1){v=nxt(v);}mint ans=0;rep(i,0,5){auto [a,b]=v[i];ans+=b;// cout<<(15*b).val()<<endl;// cout<<a.val()<<" "<<b.val()<<endl;}cout<<ans.val()<<endl;}