結果
問題 | No.2914 正閉路検出 |
ユーザー | 👑 p-adic |
提出日時 | 2024-07-18 13:36:41 |
言語 | cLay (20240714-1) |
結果 |
AC
|
実行時間 | 242 ms / 2,000 ms |
コード長 | 387 bytes |
コンパイル時間 | 4,271 ms |
コンパイル使用メモリ | 190,760 KB |
実行使用メモリ | 33,920 KB |
最終ジャッジ日時 | 2024-07-19 18:49:09 |
合計ジャッジ時間 | 12,201 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 1 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | AC | 1 ms
5,376 KB |
testcase_17 | AC | 1 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | AC | 31 ms
10,880 KB |
testcase_20 | AC | 76 ms
19,712 KB |
testcase_21 | AC | 17 ms
7,552 KB |
testcase_22 | AC | 99 ms
23,424 KB |
testcase_23 | AC | 69 ms
18,048 KB |
testcase_24 | AC | 128 ms
27,264 KB |
testcase_25 | AC | 7 ms
5,376 KB |
testcase_26 | AC | 12 ms
6,784 KB |
testcase_27 | AC | 167 ms
26,112 KB |
testcase_28 | AC | 183 ms
28,288 KB |
testcase_29 | AC | 201 ms
29,696 KB |
testcase_30 | AC | 13 ms
7,424 KB |
testcase_31 | AC | 184 ms
26,880 KB |
testcase_32 | AC | 188 ms
29,312 KB |
testcase_33 | AC | 14 ms
9,344 KB |
testcase_34 | AC | 198 ms
32,896 KB |
testcase_35 | AC | 217 ms
33,024 KB |
testcase_36 | AC | 205 ms
32,768 KB |
testcase_37 | AC | 128 ms
33,920 KB |
testcase_38 | AC | 91 ms
29,696 KB |
testcase_39 | AC | 93 ms
22,144 KB |
testcase_40 | AC | 216 ms
32,512 KB |
testcase_41 | AC | 129 ms
25,344 KB |
testcase_42 | AC | 222 ms
33,280 KB |
testcase_43 | AC | 242 ms
32,256 KB |
testcase_44 | AC | 100 ms
21,632 KB |
testcase_45 | AC | 193 ms
30,848 KB |
testcase_46 | AC | 183 ms
30,208 KB |
testcase_47 | AC | 164 ms
28,928 KB |
testcase_48 | AC | 112 ms
23,296 KB |
testcase_49 | AC | 208 ms
31,744 KB |
testcase_50 | AC | 174 ms
29,056 KB |
testcase_51 | AC | 81 ms
29,824 KB |
testcase_52 | AC | 83 ms
32,896 KB |
testcase_53 | AC | 93 ms
32,896 KB |
testcase_54 | AC | 89 ms
32,768 KB |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:378:38: warning: narrowing conversion of ‘N’ from ‘long long int’ to ‘int’ [-Wnarrowing] 378 | weightedUnionFind<long long> U{'m',N,1}; | ^ main.cpp:390:10: warning: narrowing conversion of ‘u’ from ‘long long int’ to ‘int’ [-Wnarrowing] 390 | C[{u,v}]=C[{v,u}]=j; | ^ main.cpp:390:10: warning: narrowing conversion of ‘u’ from ‘long long int’ to ‘int’ [-Wnarrowing] main.cpp:390:12: warning: narrowing conversion of ‘v’ from ‘long long int’ to ‘int’ [-Wnarrowing] 390 | C[{u,v}]=C[{v,u}]=j; | ^ main.cpp:390:12: warning: narrowing conversion of ‘v’ from ‘long long int’ to ‘int’ [-Wnarrowing] main.cpp:390:19: warning: narrowing conversion of ‘v’ from ‘long long int’ to ‘int’ [-Wnarrowing] 390 | C[{u,v}]=C[{v,u}]=j; | ^ main.cpp:390:19: warning: narrowing conversion of ‘v’ from ‘long long int’ to ‘int’ [-Wnarrowing] main.cpp:390:21: warning: narrowing conversion of ‘u’ from ‘long long int’ to ‘int’ [-Wnarrowing] 390 | C[{u,v}]=C[{v,u}]=j; | ^ main.cpp:390:21: warning: narrowing conversion of ‘u’ from ‘long long int’ to ‘int’ [-Wnarrowing]
ソースコード
ll@N,@M;int A[M],B[],p[],W[N],L,V[2M];map<VI,ll>C;weightedUnionFind<ll>U{'m',N,1};rep(j,M){ll@--(u,v),@w;if(U(u,v,w)||U.diff(u,v)==w)A[j]=u,B[j]=v,W[j]=w,C[{u,v}]=C[{v,u}]=j;else{graph g;g.setEdge(N,j,A,B);*p=j;if(L=g.shortestPath(v,u,V)+1)REP[V,i](t,L-1)w+=t==A[M=p[i+1]=C[{t,V[i+1]}]]?W[M]:-W[M];else break;wtLn(L,u+1);if(w<0)REP(i,L/2)swap(p[i],p[L-i-1]);wt(p(L)+1);return 0;}}wt(-1);