結果
| 問題 |
No.2742 Car Flow
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2024-04-20 11:26:06 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 658 bytes |
| コンパイル時間 | 2,850 ms |
| コンパイル使用メモリ | 245,084 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 06:58:28 |
| 合計ジャッジ時間 | 4,776 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 WA * 45 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>; //B(n,V<int>(n))
const int MOD=998244353;
ll modpow(ll x,ll n){
x%=MOD;
ll ans=1;
while(n){
if(n&1) ans=ans*x%MOD;
x=x*x%MOD;
n/=2;
}
return ans;
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
cin>>n;
V<int> A(n+1);
rep(i,n){
cin>>A[i];
}
A[n]=A[0];
int cnt=0;
rep(i,n) if(A[i]==1 && A[i+1]==0) cnt++;
cout<<cnt*modpow(n,MOD-2)%MOD<<endl;
return 0;
}
umezo