結果
| 問題 | No.2373 wa, wo, n |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-07 21:27:16 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 493 bytes |
| 記録 | |
| コンパイル時間 | 396 ms |
| コンパイル使用メモリ | 80,036 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-04-03 05:25:19 |
| 合計ジャッジ時間 | 4,207 ms |
|
ジャッジサーバーID (参考情報) |
judge4_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 39 |
ソースコード
#include<iostream>
#include<vector>
#include<cassert>
using namespace std;
int N;
string S;
bool dp[2<<17];
bool f(int idx,char c)
{
return S[idx]=='?'||S[idx]==c;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N>>S;
dp[0]=true;
for(int i=0;i<N;i++)if(dp[i])
{
if(i+1<N)
{//wa
if(f(i,'w')&&f(i+1,'a'))dp[i+2]=true;
}
if(i+1<N)
{//wo
if(f(i,'w')&&f(i+1,'o'))dp[i+2]=true;
}
{
if(f(i,'n'))dp[i+1]=true;
}
}
cout<<(dp[N]?"Yes":"No")<<endl;
}