結果
| 問題 | No.2195 AND Set |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2024-12-13 11:47:28 |
| 言語 | C90 (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,499 bytes |
| 記録 | |
| コンパイル時間 | 95 ms |
| コンパイル使用メモリ | 26,804 KB |
| 最終ジャッジ日時 | 2026-02-24 01:21:38 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'main':
main.c:11:32: error: expected ';' before '_'
11 | #define repeat(e) for(typeof(e)_=e;_--;)
| ^
main.c:41:9: note: in expansion of macro 'repeat'
41 | repeat(q){
| ^~~~~~
main.c:11:36: error: '_' undeclared (first use in this function)
11 | #define repeat(e) for(typeof(e)_=e;_--;)
| ^
main.c:41:9: note: in expansion of macro 'repeat'
41 | repeat(q){
| ^~~~~~
main.c:11:36: note: each undeclared identifier is reported only once for each function it appears in
11 | #define repeat(e) for(typeof(e)_=e;_--;)
| ^
main.c:41:9: note: in expansion of macro 'repeat'
41 | repeat(q){
| ^~~~~~
main.c:48:37: error: expected ';' before 'i'
48 | rep(i,31){
| ^
main.c:9:31: note: in definition of macro 'rep'
9 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
| ^
main.c:48:37: error: 'i' undeclared (first use in this function)
48 | rep(i,31){
| ^
main.c:9:35: note: in definition of macro 'rep'
9 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
| ^
main.c:59:37: error: expected ';' before 'i'
59 | rep(i,31){
| ^
main.c:9:31: note: in definition of macro 'rep'
9 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
| ^
main.c:67:30: error: expected ';' before 'i'
67 | rrep(i,31){
| ^
main.c:10:32: note: in definition of macro 'rrep'
10 | #define rrep(v,e) for(typeof(e)v=e;v--;)
| ^
ソースコード
#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 WTHI(v) {unsigned _z=v,_n=0;long _d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(long*)wp=_d;wp+=_n;}
#define WTLO(v) {unsigned _z=v,_n=8;long _d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(long*)wp=_d;wp+=8;}
#define wt(v) if(v>=100000000){WTHI(v/100000000);WTLO(v);}else{WTHI(v);}
#define rep(v,e) for(typeof(e)v=0;v<e;++v)
#define rrep(v,e) for(typeof(e)v=e;v--;)
#define repeat(e) for(typeof(e)_=e;_--;)
char wbuf[1<<25];
#define HASH_BITS 22
#define HASH_N (1<<HASH_BITS)
#define HASH_MASK (HASH_N-1)
unsigned hash[HASH_N];
int hash_add(unsigned x){
int h=x&HASH_MASK;
while(1){
if(hash[h]==0){
hash[h]=x;
return h;
}
if(hash[h]==x){
return h;
}
h=h+1&HASH_MASK;
}
}
char c[HASH_N];
int a[31];
int main(){
rd_init();
int q=rd();
char*wp=wbuf;
repeat(q){
int t=*rp; rp+=2;
if(t=='1'){
unsigned x=rd();
int h=hash_add(x+1);
if(!c[h]){
c[h]=1;
rep(i,31){
a[i]+=~x&1;
x>>=1;
}
}
}
if(t=='2'){
unsigned x=rd();
int h=hash_add(x+1);
if(c[h]){
c[h]=0;
rep(i,31){
a[i]-=~x&1;
x>>=1;
}
}
}
if(t=='3'){
unsigned v=0;
rrep(i,31){
v=v<<1|!a[i];
}
if(v&1<<30){
*wp++='-';
*wp++='1';
}else{
wt(v);
}
*wp++='\n';
}
}
write(1,wbuf,wp-wbuf);
_exit(0);
}
tails