結果
| 問題 | No.3637 PANDORA |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2026-08-28 07:48:19 |
| 言語 | C(gnu17) (gcc 15.3.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 23 ms / 2,000 ms |
| + 456µs | |
| コード長 | 1,665 bytes |
| 記録 | |
| コンパイル時間 | 1,445 ms |
| コンパイル使用メモリ | 40,064 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-28 07:48:35 |
| 合計ジャッジ時間 | 5,194 ms |
|
ジャッジサーバーID (参考情報) |
judge3_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 点 |
コンパイルメッセージ
main.c: In function 'main':
main.c:98:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
98 | write(1,wbuf,wp-wbuf);
| ^~~~~
main.c:99:9: warning: implicit declaration of function '_exit' [-Wimplicit-function-declaration]
99 | _exit(0);
| ^~~~~
main.c:99:9: warning: incompatible implicit declaration of built-in function '_exit' [-Wbuiltin-declaration-mismatch]
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define rep(v,e) for(typeof(e)v=0;v<e;++v)
#define repeat(e) for(typeof(e)_=e;_--;)
typedef unsigned long ulong;
ulong b2[26];
ulong b1[26][1<<6];
ulong b0[26][1<<12];
void bsadd(int c,int x){
b2[c]|=1ul<<(x>>12);
b1[c][x>>12]|=1ul<<(x>>6);
b0[c][x>>6]|=1ul<<x;
}
void bsdel(int c,int x){
if(!(b0[c][x>>6]&=~(1ul<<x))){
if(!(b1[c][x>>12]&=~(1ul<<(x>>6)))){
b2[c]&=~(1ul<<(x>>12));
}
}
}
int bsminge(int c,int x){
{
ulong a=b0[c][x>>6]&~0ul<<x;
if(a){
int i=__builtin_ctzl(a)|x&~0x3ful;
return i;
}
}
x=(x|0x3f)+1;
{
ulong a=b1[c][x>>12]&~0ul<<(x>>6);
if(a){
int j=__builtin_ctzl(a)|x>>6&~0x3ful;
int i=__builtin_ctzl(b0[c][j])|j<<6;
return i;
}
}
x=(x|0xfff)+1;
{
ulong a=b2[c]&~0ul<<(x>>12);
if(a){
int k=__builtin_ctzl(a);
int j=__builtin_ctzl(b1[c][k])|k<<6;
int i=__builtin_ctzl(b0[c][j])|j<<6;
return i;
}
}
return -1;
}
char wbuf[1<<25];
char s[200000];
int main(){
char*wp=wbuf;
rd_init();
int n=rd();
int q=rd();
rep(i,n){
s[i]=*rp++-'a';
bsadd(s[i],i);
}
++rp;
repeat(q){
int t=*rp; rp+=2;
if(t=='1'){
int i=rd()-1;
bsdel(s[i],i);
s[i]=*rp-'a'; rp+=2;
bsadd(s[i],i);
}else{
int j=-1;
for(int c;c=*rp++-'a',c>=0;){
j=bsminge(c,j+1);
if(j<0){
while(*rp++-'a'>=0){
}
*wp++='N';
*wp++='o';
goto hoge;
}
}
*wp++='Y';
*wp++='e';
*wp++='s';
hoge:;
*wp++='\n';
}
}
write(1,wbuf,wp-wbuf);
_exit(0);
}
tails