結果
| 問題 | No.2742 Car Flow |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-12 22:49:26 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 726 bytes |
| 記録 | |
| コンパイル時間 | 1,907 ms |
| コンパイル使用メモリ | 206,332 KB |
| 実行使用メモリ | 12,024 KB |
| 最終ジャッジ日時 | 2026-07-04 11:30:18 |
| 合計ジャッジ時間 | 101,656 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / temp-judge_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 WA * 31 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int MOD=998244353;
namespace Lib{
ll modpow(ll a,ll n){
long long ret=1,t=a;
while(n>0){
if(n&1)ret=ret*t%MOD;
t=t*t%MOD;
n/=2;
}
return ret;
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
time_t start=clock();
int N;
cin>>N;
vector B(N,0);
for(int &i:B)cin>>i;
while(clock()-start<1900000){
vector B2(N,0);
for(int j=0;j<N;j++){
B2[j]=(B[(j+N-1)%N]&(1-B[j]))|((B[j]&B[(j+1)%N]));
}
for(int j=0;j<N;j++){
B[j]=B2[j];
}
}
ll ans=0;
for(int i=0;i<N;i++){
ans+=(1-B[i])&B[(i+1)%N];
}
ans=ans*Lib::modpow(N,MOD-2)%MOD;
cout<<ans<<'\n';
}