結果
問題 | No.1023 Cyclic Tour |
ユーザー | tails |
提出日時 | 2020-11-13 01:09:15 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 1,364 bytes |
コンパイル時間 | 531 ms |
コンパイル使用メモリ | 33,496 KB |
実行使用メモリ | 11,904 KB |
最終ジャッジ日時 | 2024-07-22 19:49:41 |
合計ジャッジ時間 | 6,301 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 7 ms
5,504 KB |
testcase_05 | AC | 5 ms
5,376 KB |
testcase_06 | AC | 6 ms
5,888 KB |
testcase_07 | AC | 6 ms
5,632 KB |
testcase_08 | AC | 7 ms
5,376 KB |
testcase_09 | AC | 8 ms
5,376 KB |
testcase_10 | AC | 7 ms
5,376 KB |
testcase_11 | AC | 10 ms
5,376 KB |
testcase_12 | AC | 9 ms
5,376 KB |
testcase_13 | AC | 8 ms
5,376 KB |
testcase_14 | AC | 6 ms
5,376 KB |
testcase_15 | AC | 9 ms
5,376 KB |
testcase_16 | AC | 10 ms
7,552 KB |
testcase_17 | AC | 10 ms
7,680 KB |
testcase_18 | AC | 10 ms
7,680 KB |
testcase_19 | AC | 9 ms
7,552 KB |
testcase_20 | AC | 15 ms
7,936 KB |
testcase_21 | AC | 14 ms
8,064 KB |
testcase_22 | AC | 13 ms
7,808 KB |
testcase_23 | AC | 14 ms
7,936 KB |
testcase_24 | AC | 14 ms
8,064 KB |
testcase_25 | AC | 14 ms
7,936 KB |
testcase_26 | AC | 14 ms
7,936 KB |
testcase_27 | AC | 13 ms
7,808 KB |
testcase_28 | AC | 12 ms
7,808 KB |
testcase_29 | AC | 10 ms
7,680 KB |
testcase_30 | AC | 13 ms
8,064 KB |
testcase_31 | AC | 12 ms
7,936 KB |
testcase_32 | AC | 12 ms
8,448 KB |
testcase_33 | AC | 13 ms
8,320 KB |
testcase_34 | AC | 10 ms
7,168 KB |
testcase_35 | AC | 10 ms
7,552 KB |
testcase_36 | AC | 14 ms
7,936 KB |
testcase_37 | AC | 12 ms
8,064 KB |
testcase_38 | AC | 11 ms
7,680 KB |
testcase_39 | AC | 14 ms
7,808 KB |
testcase_40 | AC | 12 ms
7,808 KB |
testcase_41 | AC | 12 ms
7,808 KB |
testcase_42 | AC | 14 ms
8,064 KB |
testcase_43 | AC | 11 ms
7,424 KB |
testcase_44 | AC | 10 ms
5,504 KB |
testcase_45 | AC | 12 ms
7,936 KB |
testcase_46 | AC | 11 ms
7,936 KB |
testcase_47 | AC | 18 ms
11,904 KB |
testcase_48 | AC | 12 ms
8,320 KB |
testcase_49 | AC | 12 ms
8,320 KB |
testcase_50 | AC | 11 ms
8,064 KB |
testcase_51 | AC | 11 ms
8,064 KB |
testcase_52 | AC | 12 ms
8,320 KB |
コンパイルメッセージ
main.c:21:1: warning: return type defaults to 'int' [-Wimplicit-int] 21 | f1(i,p,g){ | ^~ main.c: In function 'f1': main.c:21:1: warning: type of 'i' defaults to 'int' [-Wimplicit-int] main.c:21:1: warning: type of 'p' defaults to 'int' [-Wimplicit-int] main.c:21:1: warning: type of 'g' defaults to 'int' [-Wimplicit-int] main.c:23:17: warning: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 23 | puts("Yes"); | ^~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'puts' +++ |+#include <stdio.h> 1 | #pragma GCC optimize("Ofast") main.c:24:17: warning: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 24 | exit(0); | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | #pragma GCC optimize("Ofast") main.c:24:17: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 24 | exit(0); | ^~~~ main.c:24:17: note: include '<stdlib.h>' or provide a declaration of 'exit' main.c: At top level: main.c:40:1: warning: return type defaults to 'int' [-Wimplicit-int] 40 | f2(i){ | ^~ main.c: In function 'f2': main.c:40:1: warning: type of 'i' defaults to 'int' [-Wimplicit-int] main.c:44:25: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 44 | exit(0); | ^~~~ main.c:44:25: note: include '<stdlib.h>' or provide a declaration of 'exit' main.c: At top level: main.c:57:1: warning: return type defaults to 'int' [-Wimplicit-int] 57 | main(){ | ^~~~
ソースコード
#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;} #define MAXN 100001 #define MAXE 200000 int enb[MAXN+1]; int ebb[MAXE*2]; int uvb[MAXE*2]; int uvbn; int enu[MAXN+1]; int ebu[MAXE]; int uvu[MAXE*2]; int uvun; int gr[MAXN]; f1(i,p,g){ if(gr[i]){ puts("Yes"); exit(0); } gr[i]=g; if(i!=g){ enu[g]+=enu[i]; enu[i]=0; } for(int k=enb[i];k<enb[i+1];++k){ int j=ebb[k]; if(j!=p){ f1(j,i,g); } } } char vis[MAXN]; f2(i){ if(vis[i]){ if(vis[i]==1){ puts("Yes"); exit(0); } }else{ vis[i]=1; for(int k=enu[i];k<enu[i+1];++k){ int j=ebu[k]; f2(j); } vis[i]=2; } } main(){ char*rp=mmap(0l,7l*2+16l*200000+32,1,2,0,0ll); RD(n); RD(m); for(int j=0;j<m;++j){ RD(t0); RD(t1); int b=*rp&1; rp+=2; if(b){ uvb[uvbn++]=t0; uvb[uvbn++]=t1; enb[t0]+=1; enb[t1]+=1; }else{ uvu[uvun++]=t0; uvu[uvun++]=t1; enu[t0]+=1; } } for(int i=2;i<=n+1;++i){ enb[i]+=enb[i-1]; } for(int j=0;j<uvbn;++j){ int i=uvb[j]; ebb[--enb[i]]=uvb[j^1]; } for(int i=1;i<=n;++i){ if(!gr[i]){ f1(i,0,i); } } for(int i=2;i<=n+1;++i){ enu[i]+=enu[i-1]; } for(int j=0;j<uvun;j+=2){ int i=gr[uvu[j]]; ebu[--enu[i]]=gr[uvu[j^1]]; } for(int i=1;i<=n;++i){ if(gr[i]==i){ f2(i); } } puts("No"); }