結果

問題 No.3637 PANDORA
コンテスト
ユーザー あるふぁ
提出日時 2026-08-26 00:55:37
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.90.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 298 ms / 2,000 ms
+ 218µs
コード長 3,327 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,773 ms
コンパイル使用メモリ 332,732 KB
実行使用メモリ 13,312 KB
最終ジャッジ日時 2026-08-26 00:55:47
合計ジャッジ時間 9,240 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
サブタスク 配点 結果
サンプル 0 % AC * 2
小課題1 5 % AC * 4
小課題2 10 % AC * 4
小課題3 5 % AC * 8
小課題4 10 % AC * 5
小課題5 20 % AC * 10
小課題6 20 % AC * 16
小課題7 30 % AC * 38
合計 100 点
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from main.cpp:6:
/home/linuxbrew/.linuxbrew/Cellar/gcc/16.1.0/include/c++/16/ciso646:49:6: warning: #warning "<ciso646> is not a standard header since C++20, use <version> to detect implementation-specific macros" [-Wcpp]
   49 | #    warning "<ciso646> is not a standard header since C++20, use <version> to detect implementation-specific macros"
      |      ^~~~~~~
In file included from main.cpp:18:
/home/linuxbrew/.linuxbrew/Cellar/gcc/16.1.0/include/c++/16/ccomplex:51:4: warning: #warning "<ccomplex> is deprecated in C++17, use <complex> instead" [-Wcpp]
   51 | #  warning "<ccomplex> is deprecated in C++17, use <complex> instead"
      |    ^~~~~~~
In file included from main.cpp:21:
/home/linuxbrew/.linuxbrew/Cellar/gcc/16.1.0/include/c++/16/cstdalign:50:6: warning: #warning "<cstdalign> is deprecated in C++17, remove the #include" [-Wcpp]
   50 | #    warning "<cstdalign> is deprecated in C++17, remove the #include"
      |      ^~~~~~~
In file included from main.cpp:22:
/home/linuxbrew/.linuxbrew/Cellar/gcc/16.1.0/include/c++/16/cstdbool:50:6: warning: #warning "<cstdbool> is deprecated in C++17, remove the #include" [-Wcpp]
   50 | #    warning "<cstdbool> is deprecated in C++17, remove the #include"
      |      ^~~~~~~
In file included from main.cpp:24:
/home/linuxbrew/.linuxbrew/Cellar/gcc/16.1.0/include/c++/16/ctgmath:50:6: warning: #warning "<ctgmath> is deprecated in C++17, use <complex> or <cmath> instead" [-Wcpp]
   50 | #    warning "<ctgmath> is deprecated in C++17, use <complex> or <cmath> instead"
      |      ^~~~~~~

ソースコード

diff #
raw source code

#include <inttypes.h>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

// #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pob pop_back
#define eb emplace_back
#define nall(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define yesno(a) cout<<(a?"YES\n":"NO\n")
#define accu accumulate
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
template<class T> using vec = vector<T>;
template<class T> using vv = vector<vector<T>>;
template<class T> using vvv = vector<vv<T>>;
const ll MOD = 998244353ll;
// const ll MOD = 1000000007ll;

void solve();
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(20);
    int t = 1;
    // cin >> t;
    while (t--) solve();
    return 0;
}

void solve(){
    int N, Q;
    string S;
    cin >> N >> Q >> S;
    array<set<int>, 26> A;
    rep(i, 26) A[i].insert(N);
    rep(i, N) A[S[i]-'a'].insert(i);

    while (Q--){
        int t;
        cin >> t;
        if (t == 1){
            int i;
            char c;
            cin >> i >> c, i--;
            A[S[i]-'a'].erase(i);
            S[i] = c;
            A[S[i]-'a'].insert(i);
        }
        else{
            string s;
            int now = -1;
            bool ok = true;
            cin >> s;
            for (char c : s){
                now = *A[c-'a'].ub(now);
                if (now == N){
                    ok = false;
                    break;
                }
            }
            cout << (ok? "Yes": "No") << endl;
        }
    }
}
0