結果
| 問題 | No.938 賢人を探せ |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2021-01-19 09:23:21 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 776 bytes |
| 記録 | |
| コンパイル時間 | 154 ms |
| コンパイル使用メモリ | 28,700 KB |
| 最終ジャッジ日時 | 2026-02-21 05:44:46 |
| 合計ジャッジ時間 | 848 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'hashf':
main.c:26:20: error: implicit declaration of function 'memcmp' [-Wimplicit-function-declaration]
26 | if(memcmp(hashtbl[h],s,p-s)==0 && hashtbl[h][p-s]<64){
| ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memcmp'
+++ |+#include <string.h>
1 | #pragma GCC optimize("Ofast")
main.c:26:41: warning: 'memcmp' argument 3 type is 'long int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
26 | if(memcmp(hashtbl[h],s,p-s)==0 && hashtbl[h][p-s]<64){
| ~^~
<built-in>: note: built-in 'memcmp' declared here
main.c: At top level:
main.c:35:1: error: return type defaults to 'int' [-Wimplicit-int]
35 | main(){
| ^~~~
main.c: In function 'main':
main.c:36:17: error: implicit declaration of function 'time' [-Wimplicit-function-declaration]
36 | hashmul=time(0)|1;
| ^~~~
main.c:1:1: note: 'time' is defined in header '<time.h>'; this is probably fixable by adding '#include <time.h>'
+++ |+#include <time.h>
1 | #pragma GCC optimize("Ofast")
main.c:37:17: error: too many arguments to function 'mmap'; expected 0, have 6
37 | char*rp=mmap(0l,1l<<28,1,2,0,0ll);
| ^~~~ ~~
main.c:4:6: note: declared here
4 | char*mmap();
| ^~~~
main.c:53:9: error: implicit declaration of function 'write' [-Wimplicit-function-declaration]
53 | write(1,wbuf,wp-wbuf);
| ^~~~~
main.c:54:9: error: implicit declaration of function '_exit' [-Wimplicit-function-declaration]
54 | _exit(0);
| ^~~~~
main.c:54:9: warning: incompatible implicit declaration of built-in function '_exit' [-Wbuiltin-declaration-mismatch]
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char*mmap();
char wbuf[20<<20];
#define HASHSIZE (1<<20)
char* hashtbl[HASHSIZE];
int hashmul;
int hashf(char*s){
int h=0;
char*p=s;
while(*p>=64){
h=h*hashmul+*p;
++p;
}
int a=h>>20|1;
h&=HASHSIZE-1;
while(1){
if(!hashtbl[h]){
hashtbl[h]=s;
return 1;
}
if(memcmp(hashtbl[h],s,p-s)==0 && hashtbl[h][p-s]<64){
return 0;
}
h=h+a&HASHSIZE-1;
}
}
char*bs[200000];
main(){
hashmul=time(0)|1;
char*rp=mmap(0l,1l<<28,1,2,0,0ll);
while(*rp++!=10);
int n=0;
do{
hashf(rp);
while(*rp++>=64);
bs[n++]=rp;
while(*rp++>=64);
}while(*rp);
char*wp=wbuf;
for(int i=0;i<n;++i){
char*p=bs[i];
if(hashf(p)){
while((*wp++=*p++)>=64);
}
}
write(1,wbuf,wp-wbuf);
_exit(0);
}
tails