結果
問題 |
No.3197 Frequency Counter
|
ユーザー |
![]() |
提出日時 | 2025-07-12 00:30:23 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 854 bytes |
コンパイル時間 | 1,274 ms |
コンパイル使用メモリ | 27,896 KB |
実行使用メモリ | 13,656 KB |
最終ジャッジ日時 | 2025-07-12 00:30:27 |
合計ジャッジ時間 | 3,292 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:44:35: warning: multi-character character constant [-Wmultichar] 44 | *(int*)wp='\nseY'; | ^~~~~~~ main.c:47:35: warning: multi-character character constant [-Wmultichar] 47 | *(int*)wp='\noN'; | ^~~~~~ main.c:51:9: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration] 51 | write(1,wbuf,wp-wbuf); | ^~~~~ main.c:52:9: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration] 52 | _exit(0); | ^~~~~ main.c:52: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 repeat(e) for(typeof(e)_=e;_--;) #define HASH_BITS 19 #define HASH_N (1<<HASH_BITS) #define HASH_MASK (HASH_N-1) int hash[HASH_N]; int hash_get(int 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; } } int count[HASH_N]; char wbuf[1<<25]; int main(){ char*wp=wbuf; rd_init(); int n=rd(); repeat(n){ int a=rd(); int h=hash_get(a); count[h]+=1; } int q=rd(); repeat(q){ int x=rd(); int k=rd(); if(count[hash_get(x)]>=k){ *(int*)wp='\nseY'; wp+=4; }else{ *(int*)wp='\noN'; wp+=3; } } write(1,wbuf,wp-wbuf); _exit(0); }