結果
問題 | No.2373 wa, wo, n |
ユーザー | EWire |
提出日時 | 2023-07-07 22:08:35 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,398 bytes |
コンパイル時間 | 4,916 ms |
コンパイル使用メモリ | 265,876 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-21 18:11:16 |
合計ジャッジ時間 | 6,382 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,812 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 2 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,944 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,944 KB |
testcase_08 | WA | - |
testcase_09 | AC | 2 ms
6,940 KB |
testcase_10 | AC | 1 ms
6,940 KB |
testcase_11 | AC | 2 ms
6,944 KB |
testcase_12 | AC | 1 ms
6,944 KB |
testcase_13 | AC | 2 ms
6,944 KB |
testcase_14 | AC | 8 ms
6,940 KB |
testcase_15 | AC | 3 ms
6,948 KB |
testcase_16 | AC | 8 ms
6,944 KB |
testcase_17 | AC | 4 ms
6,940 KB |
testcase_18 | AC | 2 ms
6,944 KB |
testcase_19 | AC | 3 ms
6,940 KB |
testcase_20 | AC | 5 ms
6,944 KB |
testcase_21 | AC | 4 ms
6,940 KB |
testcase_22 | AC | 4 ms
6,940 KB |
testcase_23 | AC | 6 ms
6,940 KB |
testcase_24 | AC | 2 ms
6,940 KB |
testcase_25 | AC | 2 ms
6,944 KB |
testcase_26 | AC | 2 ms
6,940 KB |
testcase_27 | AC | 2 ms
6,940 KB |
testcase_28 | AC | 2 ms
6,940 KB |
testcase_29 | AC | 2 ms
6,940 KB |
testcase_30 | AC | 2 ms
6,944 KB |
testcase_31 | AC | 2 ms
6,940 KB |
testcase_32 | AC | 9 ms
6,944 KB |
testcase_33 | AC | 7 ms
6,944 KB |
testcase_34 | AC | 8 ms
6,944 KB |
testcase_35 | AC | 6 ms
6,940 KB |
testcase_36 | AC | 8 ms
6,940 KB |
testcase_37 | AC | 7 ms
6,940 KB |
testcase_38 | AC | 7 ms
6,944 KB |
testcase_39 | AC | 7 ms
6,940 KB |
testcase_40 | AC | 8 ms
6,944 KB |
testcase_41 | AC | 8 ms
6,940 KB |
testcase_42 | AC | 7 ms
6,940 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; // input template<class T> istream &operator>>(istream &is, vector<T> &v){ for(T &in : v) is >> in; return is; } template<class T, class S> istream &operator>>(istream &is, pair<T, S> &p){ is >> p.first >> p.second; return is; } template<class... T> void input(T&... a) {(cin >> ... >> a);} //output template<class T> ostream & operator<<(ostream &os, const vector<T> &v){ for(int i = 0; i < (int)v.size(); i++) os << (i == 0 ? "" : " ") << v[i]; return os; } template<class T, class S> ostream &operator<<(ostream &os, const pair<T, S> &p){ os << p.first << " " << p.second; return os; } template<class T, class S> ostream &operator<<(ostream &os, const map<T, S> &mp){ for(auto &[key, val] : mp) os << key << ":" << val << " "; return os; } template<class T> ostream &operator<<(ostream &os, const set<T> &st){ for(auto itr = st.begin(); itr != st.end(); itr++) os << (itr == st.begin() ? "" : " ") << *itr; return os; } template<class T> ostream &operator<<(ostream &os, const multiset<T> &st){ for(auto itr = st.begin(); itr != st.end(); itr++) os << (itr == st.begin() ? "" : " ") << *itr; return os; } template<class T> ostream &operator<<(ostream &os, queue<T> que){ while(!que.empty()) { os << que.front(); que.pop(); if(!que.empty()) os << " "; } return os; } template<class T> ostream &operator<<(ostream &os, stack<T> st){ while(!st.empty()) { os << st.top(); st.pop(); if(!st.empty()) os << " "; } return os; } template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq) { while (!pq.empty()){ os << pq.top(); pq.pop(); if(!pq.empty()) os << " "; } return os; } void print() {cout << "\n";} template<class T> void print(const T& a) {cout << a << '\n';} template<class T, class... Ts> void print(const T& a, const Ts&... b) {cout << a; (..., (cout << ' ' << b)); cout << '\n';} #define debug(var) cout << #var << " = ";print(var); typedef long long lint; #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=int(a);i<int(b);++i) #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define _overload3(_1,_2,_3,name,...) name #define _rrep(i,n) rrepi(i,n,0) #define rrepi(i,a,b) for(int i=int(a-1);i>=int(b);--i) #define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep)(__VA_ARGS__) #define all(x) (x).begin(),(x).end() template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } int main() { int N; string S; input(N, S); stack<char> st; rep(i, N){ if(st.empty()){ if(S[i] == 'w' || S[i] == '?') st.push(S[i]); else if(S[i] == 'n') continue; else {print("No"); return 0;} } else{ if(st.top() == 'w'){ if(S[i] == 'a' || S[i] == 'o' || S[i] == '?') st.pop(); else {print("No"); return 0;} } else{ if(S[i] == 'a' || S[i] == 'o' || S[i] == 'n') st.pop(); else {st.pop(); st.push(S[i]);} } } } print("Yes"); }