結果
問題 | No.2715 Unique Chimatagram |
ユーザー | tails |
提出日時 | 2024-04-05 23:34:15 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 56 ms / 2,000 ms |
コード長 | 1,227 bytes |
コンパイル時間 | 1,077 ms |
コンパイル使用メモリ | 25,472 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-01 03:09:52 |
合計ジャッジ時間 | 2,538 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,820 KB |
testcase_02 | AC | 0 ms
6,816 KB |
testcase_03 | AC | 1 ms
6,816 KB |
testcase_04 | AC | 1 ms
6,820 KB |
testcase_05 | AC | 1 ms
6,816 KB |
testcase_06 | AC | 1 ms
6,816 KB |
testcase_07 | AC | 1 ms
6,820 KB |
testcase_08 | AC | 3 ms
6,816 KB |
testcase_09 | AC | 3 ms
6,820 KB |
testcase_10 | AC | 3 ms
6,820 KB |
testcase_11 | AC | 3 ms
6,816 KB |
testcase_12 | AC | 3 ms
6,816 KB |
testcase_13 | AC | 3 ms
6,816 KB |
testcase_14 | AC | 2 ms
6,820 KB |
testcase_15 | AC | 3 ms
6,820 KB |
testcase_16 | AC | 2 ms
6,820 KB |
testcase_17 | AC | 3 ms
6,816 KB |
testcase_18 | AC | 49 ms
6,820 KB |
testcase_19 | AC | 49 ms
6,820 KB |
testcase_20 | AC | 49 ms
6,824 KB |
testcase_21 | AC | 49 ms
6,820 KB |
testcase_22 | AC | 56 ms
6,820 KB |
testcase_23 | AC | 48 ms
6,816 KB |
testcase_24 | AC | 44 ms
6,824 KB |
testcase_25 | AC | 56 ms
6,820 KB |
testcase_26 | AC | 50 ms
6,820 KB |
testcase_27 | AC | 50 ms
6,816 KB |
testcase_28 | AC | 2 ms
6,820 KB |
testcase_29 | AC | 1 ms
6,816 KB |
testcase_30 | AC | 1 ms
6,820 KB |
testcase_31 | AC | 1 ms
6,820 KB |
testcase_32 | AC | 1 ms
6,820 KB |
testcase_33 | AC | 0 ms
6,816 KB |
testcase_34 | AC | 0 ms
6,816 KB |
testcase_35 | AC | 0 ms
6,816 KB |
testcase_36 | AC | 0 ms
6,820 KB |
testcase_37 | AC | 1 ms
6,820 KB |
testcase_38 | AC | 1 ms
6,816 KB |
testcase_39 | AC | 1 ms
6,820 KB |
testcase_40 | AC | 1 ms
6,824 KB |
testcase_41 | AC | 2 ms
6,816 KB |
testcase_42 | AC | 0 ms
6,820 KB |
コンパイルメッセージ
main.c: In function ‘f2’: main.c:60:25: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration] 60 | memcpy(wbuf,ss[hn[h]-1],11); | ^~~~~~ main.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’ +++ |+#include <string.h> 1 | #pragma GCC optimize("Ofast") main.c:60:25: warning: incompatible implicit declaration of built-in function ‘memcpy’ [-Wbuiltin-declaration-mismatch] 60 | memcpy(wbuf,ss[hn[h]-1],11); | ^~~~~~ main.c:60:25: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’ main.c:69:41: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration] 69 | write(1,wbuf,j); | ^~~~~ main.c:70:41: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration] 70 | _exit(0); | ^~~~~ main.c:70:41: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch] main.c:73:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch] 73 | _exit(1); | ^~~~~ main.c:77:9: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch] 77 | _exit(0); | ^~~~~
ソースコード
#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 HASH_BITS 16 #define HASH_MASK ((1<<HASH_BITS)-1) unsigned hash[1<<HASH_BITS]; 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; } } int hn[1<<HASH_BITS]; char ss[1000][11]; unsigned ch[26]; void f0(){ unsigned v=1; rep(i,26){ ch[i]=v; v*=257; } } void f1(){ rd_init(); int n=rd(); rep(i,n){ char*s=ss[i]; int j=0; unsigned v=0; for(int c;c=*rp++,c>='a';){ s[j++]=c; v+=ch[c-'a']; } rep(c,26){ int h=hash_add(v+ch[c]); hn[h]=hn[h]?-1:i+1; } } } void f2(){ rep(h,1<<HASH_BITS){ if(hn[h]>0){ char wbuf[16]; memcpy(wbuf,ss[hn[h]-1],11); unsigned v=hash[h]; int j=0; for(int c;c=wbuf[j++],c>='a';){ v-=ch[c-'a']; } rep(c,26){ if(ch[c]==v){ wbuf[j-1]=c+'a'; write(1,wbuf,j); _exit(0); } } _exit(1); } } write(1,"-1",2); _exit(0); } int main(){ f0(); f1(); f2(); }