結果
問題 |
No.2535 多重同値
|
ユーザー |
![]() |
提出日時 | 2023-11-10 22:01:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 515 bytes |
コンパイル時間 | 1,971 ms |
コンパイル使用メモリ | 202,860 KB |
最終ジャッジ日時 | 2025-02-17 20:46:57 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 TLE * 1 -- * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<bool> P(N + 1); for (int i = 1; i <= N; i++) { string s; cin >> s; P[i] = s == "Yes"; } map<pair<int, int>, bool> memo; auto X = [&](auto&& X, int l, int r) -> bool { if (l == r) { return P[l]; } if (memo.count(make_pair(l, r))) { return memo[make_pair(l, r)]; } return memo[make_pair(l, r)] = P[l] == X(X, l + 1, r); }; for (int i = 1; i <= N; i++) { cout << (X(X, 1, i) ? "Yes\n" : "No\n"); } }