結果
| 問題 | No.556 仁義なきサルたち |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2020-11-25 09:57:08 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,075 bytes |
| 記録 | |
| コンパイル時間 | 102 ms |
| コンパイル使用メモリ | 28,544 KB |
| 最終ジャッジ日時 | 2026-02-22 06:21:07 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c:37:1: error: return type defaults to 'int' [-Wimplicit-int]
37 | main(){
| ^~~~
main.c: In function 'main':
main.c:39:17: error: too many arguments to function 'mmap'; expected 0, have 6
39 | char*rp=mmap(0l,6l*20003,1,2,0,0ll);
| ^~~~ ~~
main.c:4:6: note: declared here
4 | char*mmap();
| ^~~~
main.c:61:9: error: implicit declaration of function 'write' [-Wimplicit-function-declaration]
61 | write(1,wbuf,(char*)wp-(char*)wbuf);
| ^~~~~
main.c:62:9: error: implicit declaration of function '_exit' [-Wimplicit-function-declaration]
62 | _exit(0);
| ^~~~~
main.c:62:9: warning: incompatible implicit declaration of built-in function '_exit' [-Wbuiltin-declaration-mismatch]
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char*mmap();
#define RD(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
long wbuf[10000];
#define WT(v) {long _z=v,_d=0;while(_d=_d<<8|0x30|_z%10,_z/=10);*wp++=_d|0x0a20202020202020l;}
#define UFSIZE 10001
int ufbuf[UFSIZE];
void uf_init(){
for(int i=0;i<UFSIZE;++i){
ufbuf[i]=-1;
}
}
int uf_root(int a){
int b;
int t=a;
while(b=ufbuf[t],b>=0) t=b;
while(b=ufbuf[a],b>=0) ufbuf[a]=t,a=b;
return t;
}
void uf_unite(int a,int b){
a=uf_root(a);
b=uf_root(b);
if(a!=b){
if(ufbuf[a]<ufbuf[b]){
ufbuf[a]+=ufbuf[b];
ufbuf[b]=a;
}else{
ufbuf[b]+=ufbuf[a];
ufbuf[a]=b;
}
}
}
main(){
uf_init();
char*rp=mmap(0l,6l*20003,1,2,0,0ll);
RD(n);
while(*rp++!=10);
do{
RD(a);
RD(b);
a=uf_root(a);
b=uf_root(b);
if(a!=b){
if((ufbuf[a]-ufbuf[b]?:a-b)<0){
ufbuf[a]+=ufbuf[b];
ufbuf[b]=a;
}else{
ufbuf[b]+=ufbuf[a];
ufbuf[a]=b;
}
}
}while(*rp);
long*wp=wbuf;
for(int i=1;i<=n;++i){
WT(uf_root(i));
}
write(1,wbuf,(char*)wp-(char*)wbuf);
_exit(0);
}
tails