結果

問題 No.2373 wa, wo, n
ユーザー nwo
提出日時 2023-06-17 12:52:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 1,529 ms
コンパイル使用メモリ 176,976 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-02 11:27:11
合計ジャッジ時間 2,751 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)

//嘘解法?もしかしたら正当性あり

int main()
{
	int N;
	cin >> N;
	string S;
	cin >> S;

	bool ok = true;
	vector<string> A = {"wan","won","nwa","nwo","nnn"};
	set<string> st;
	rep(i,5) rep(b,1<<3)
	{
		string a = A[i];
		rep(j,3) if(b>>j&1) a[j] = '?';
		st.insert(a);
	}

	for(int i = 0; i<N-2; i+=2)
	{
		string T = S.substr(i,3);
		if(!st.count(T)) ok = false;
	}
	cout << (ok?"Yes":"No") << endl;
}
0