結果
問題 | No.2160 みたりのDominator |
ユーザー | hotman78 |
提出日時 | 2022-12-08 13:19:08 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,568 bytes |
コンパイル時間 | 3,224 ms |
コンパイル使用メモリ | 241,936 KB |
実行使用メモリ | 79,968 KB |
最終ジャッジ日時 | 2024-10-14 11:26:51 |
合計ジャッジ時間 | 19,640 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,816 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,820 KB |
testcase_04 | AC | 2 ms
6,816 KB |
testcase_05 | AC | 2 ms
6,816 KB |
testcase_06 | AC | 2 ms
6,816 KB |
testcase_07 | AC | 2 ms
6,816 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 2 ms
6,816 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 3 ms
6,816 KB |
testcase_24 | AC | 2 ms
6,816 KB |
testcase_25 | AC | 2 ms
6,816 KB |
testcase_26 | AC | 2 ms
6,816 KB |
testcase_27 | AC | 2 ms
6,820 KB |
testcase_28 | AC | 2 ms
6,820 KB |
testcase_29 | AC | 2 ms
6,816 KB |
testcase_30 | AC | 2 ms
6,820 KB |
testcase_31 | AC | 2 ms
6,820 KB |
testcase_32 | AC | 2 ms
6,816 KB |
testcase_33 | AC | 2 ms
6,820 KB |
testcase_34 | AC | 2 ms
6,816 KB |
testcase_35 | AC | 2 ms
6,820 KB |
testcase_36 | AC | 2 ms
6,820 KB |
testcase_37 | AC | 2 ms
6,820 KB |
testcase_38 | AC | 1 ms
6,820 KB |
testcase_39 | AC | 2 ms
6,816 KB |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | AC | 536 ms
48,540 KB |
testcase_56 | AC | 408 ms
30,776 KB |
testcase_57 | AC | 441 ms
34,420 KB |
testcase_58 | AC | 487 ms
39,792 KB |
testcase_59 | AC | 459 ms
35,204 KB |
testcase_60 | AC | 359 ms
26,872 KB |
testcase_61 | AC | 521 ms
46,428 KB |
testcase_62 | AC | 562 ms
53,668 KB |
testcase_63 | AC | 525 ms
47,528 KB |
testcase_64 | AC | 332 ms
26,212 KB |
testcase_65 | AC | 226 ms
40,980 KB |
testcase_66 | AC | 300 ms
44,192 KB |
testcase_67 | AC | 304 ms
45,636 KB |
testcase_68 | AC | 610 ms
79,968 KB |
testcase_69 | AC | 431 ms
58,544 KB |
testcase_70 | AC | 590 ms
78,368 KB |
testcase_71 | AC | 160 ms
31,948 KB |
testcase_72 | AC | 363 ms
58,740 KB |
testcase_73 | AC | 632 ms
72,224 KB |
testcase_74 | AC | 605 ms
68,388 KB |
testcase_75 | AC | 2 ms
6,820 KB |
testcase_76 | AC | 2 ms
6,816 KB |
testcase_77 | AC | 237 ms
45,324 KB |
testcase_78 | AC | 323 ms
55,740 KB |
testcase_79 | AC | 9 ms
6,816 KB |
testcase_80 | AC | 12 ms
6,816 KB |
testcase_81 | AC | 11 ms
6,820 KB |
testcase_82 | AC | 28 ms
9,196 KB |
testcase_83 | AC | 64 ms
14,816 KB |
61_evil_bias_nocross_01.txt | WA | - |
61_evil_bias_nocross_02.txt | WA | - |
61_evil_bias_nocross_03.txt | WA | - |
61_evil_bias_nocross_04.txt | WA | - |
61_evil_bias_nocross_05.txt | WA | - |
61_evil_bias_nocross_06.txt | WA | - |
61_evil_bias_nocross_07.txt | WA | - |
61_evil_bias_nocross_08.txt | WA | - |
61_evil_bias_nocross_09.txt | WA | - |
61_evil_bias_nocross_10.txt | WA | - |
61_evil_bias_nocross_11.txt | WA | - |
61_evil_bias_nocross_12.txt | WA | - |
ソースコード
#include<bits/stdc++.h> #include<atcoder/scc> #include<atcoder/dsu> using namespace std; using namespace atcoder; #define rep(i,n) for(int i=0;i<int(n);++i) using lint=long long; int main(){ array<int,3>n; int m,ns=0; rep(i,3)cin>>n[i]; rep(i,3)ns+=n[i]; cin>>m; vector<int>u(m),v(m),st; rep(i,m){ cin>>u[i]>>v[i]; u[i]--;v[i]--; st.emplace_back(u[i]); st.emplace_back(v[i]); } st.emplace_back(ns); st.emplace_back(ns+1); sort(st.begin(),st.end()); st.erase(unique(st.begin(),st.end()),st.end()); int n2=st.size(); vector<vector<pair<int,int>>> g(n2); scc_graph scc(n2); auto get=[&](int i){ return lower_bound(st.begin(),st.end(),i)-st.begin(); }; //cerr<<n2<<endl; { int now=0,pre=0; rep(i,3){ //cerr<<st[now]<<endl; if(st[now]>=pre+n[i]){ g[n2-2].emplace_back(n2-1,n[i]+1); pre+=n[i]; continue; } g[n2-2].emplace_back(now,st[now]-pre+1); while(1){ if(st[now+1]-pre>=n[i])break; g[now].emplace_back(now+1,(st[now+1]-pre+1)-(st[now]-pre+1)); now++; } g[now].emplace_back(n2-1,(n[i]+1)-(st[now]-pre+1)); now++; pre+=n[i]; } } rep(i,m){ g[get(u[i])].emplace_back(get(v[i]),1); g[get(v[i])].emplace_back(get(u[i]),1); } rep(i,n2){ for(auto [e,c]:g[i]){ scc.add_edge(i,e); } } auto res=scc.scc(); int sz=res.size(); vector<vector<pair<lint,lint>>>g2(sz); vector<int>id(n2); rep(i,sz){ for(auto s:res[i]){ id[s]=i; } } rep(j,sz){ map<lint,lint>l; for(auto i:res[j]){ for(auto [e,c]:g[i]){ if(id[i]==id[e])continue; if(l[id[e]]==0)l[id[e]]=1; l[id[e]]*=c; } } for(auto [e,c]:l){ g2[j].emplace_back(e,c); } } lint ans=0,tmp=1; vector<lint>div(sz,1); rep(i,sz-1){ if(g2[i].size()==1&&i!=0)continue; tmp/=div[i]; for(auto [e,c]:g2[i]){ lint to=e; while(g2[to].size()==1){ c+=g2[to][0].second; to=g2[to][0].first; } //cerr<<e<<c<<endl; tmp*=c; div[to]*=c; } //cerr<<tmp<<endl; ans+=tmp; } cout<<ans<<endl; /**/}