結果

問題 No.3638 Itsuki
コンテスト
ユーザー Jupiter17
提出日時 2026-08-25 14:36:44
言語 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
結果
WA  
実行時間 -
コード長 944 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,449 ms
コンパイル使用メモリ 358,764 KB
実行使用メモリ 1,122,944 KB
最終ジャッジ日時 2026-08-25 14:37:13
合計ジャッジ時間 10,474 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
サブタスク 配点 結果
サンプル 0 % WA * 2
小課題1 10 % WA * 1 MLE * 1 -- * 3
小課題2 50 % -- * 6
小課題3 40 % WA * 3 MLE * 1 -- * 14
合計 0 点
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
void submain(int a, int q, string S) {
	while (q--) {
		int n;
		cin >> n;
		if (n==1) {
			int x;
			char y;
			cin >> x >> y;
			S[x] = y;
		}
		else {
			char y;
			cin >> y;
			if (S[0] == y) cout << "Yes" << endl;
			else cout << "No" << endl;
		}
	}
	return;
}
int main() {
  int a, q;
  cin >> a >> q;
  string S;
  cin >> S;
  if (a == 1) {
  	submain(a, q, S);
  	return 0;
  }
  set<string> s;
  for (int i = 1; i <= min(a, 1000); i++) {
  	//i文字のものをセットに追加
  	for (int k = 0; k <= a-i; k++) {
  		string x;
  		for (int m = k; m < k+i; m++) {
  			x += S[m];
  		}
  		s.insert(x);
  	}
  }
  while (q--) {
  	int x;
  	cin >> x;
  	if (x==1) {
  		int z;
  		cin >> z;
  		char y;
  		cin >> y;
  		S[z] = y;
  	}
  	else {
  		string a;
  		cin >> a;
  		if (s.count(a)) {
  			cout << "Yes" << endl;
  		}
  		else {
  			cout << "No" << endl;
  		}
  	}
  }
}
0