結果
問題 | No.1254 補強への架け橋 |
ユーザー | yuji9511 |
提出日時 | 2020-10-09 23:49:39 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 245 ms / 2,000 ms |
コード長 | 1,981 bytes |
コンパイル時間 | 2,372 ms |
コンパイル使用メモリ | 221,224 KB |
実行使用メモリ | 29,428 KB |
最終ジャッジ日時 | 2024-07-20 14:42:18 |
合計ジャッジ時間 | 16,308 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4 ms
5,888 KB |
testcase_01 | AC | 3 ms
5,888 KB |
testcase_02 | AC | 4 ms
5,888 KB |
testcase_03 | AC | 3 ms
6,016 KB |
testcase_04 | AC | 3 ms
5,888 KB |
testcase_05 | AC | 4 ms
5,888 KB |
testcase_06 | AC | 3 ms
6,016 KB |
testcase_07 | AC | 3 ms
5,760 KB |
testcase_08 | AC | 3 ms
5,888 KB |
testcase_09 | AC | 4 ms
6,016 KB |
testcase_10 | AC | 4 ms
6,016 KB |
testcase_11 | AC | 4 ms
5,888 KB |
testcase_12 | AC | 3 ms
5,888 KB |
testcase_13 | AC | 4 ms
5,760 KB |
testcase_14 | AC | 4 ms
5,888 KB |
testcase_15 | AC | 4 ms
6,016 KB |
testcase_16 | AC | 4 ms
5,888 KB |
testcase_17 | AC | 4 ms
5,888 KB |
testcase_18 | AC | 3 ms
5,888 KB |
testcase_19 | AC | 4 ms
5,888 KB |
testcase_20 | AC | 3 ms
5,888 KB |
testcase_21 | AC | 4 ms
5,888 KB |
testcase_22 | AC | 4 ms
6,016 KB |
testcase_23 | AC | 4 ms
5,888 KB |
testcase_24 | AC | 4 ms
5,888 KB |
testcase_25 | AC | 4 ms
5,888 KB |
testcase_26 | AC | 4 ms
5,888 KB |
testcase_27 | AC | 3 ms
5,888 KB |
testcase_28 | AC | 3 ms
6,016 KB |
testcase_29 | AC | 3 ms
5,888 KB |
testcase_30 | AC | 4 ms
5,888 KB |
testcase_31 | AC | 4 ms
5,888 KB |
testcase_32 | AC | 4 ms
5,888 KB |
testcase_33 | AC | 3 ms
5,888 KB |
testcase_34 | AC | 4 ms
5,888 KB |
testcase_35 | AC | 4 ms
5,888 KB |
testcase_36 | AC | 4 ms
5,888 KB |
testcase_37 | AC | 4 ms
5,888 KB |
testcase_38 | AC | 3 ms
5,888 KB |
testcase_39 | AC | 4 ms
6,016 KB |
testcase_40 | AC | 3 ms
5,760 KB |
testcase_41 | AC | 4 ms
5,888 KB |
testcase_42 | AC | 4 ms
5,888 KB |
testcase_43 | AC | 5 ms
6,144 KB |
testcase_44 | AC | 4 ms
6,016 KB |
testcase_45 | AC | 4 ms
5,888 KB |
testcase_46 | AC | 4 ms
6,016 KB |
testcase_47 | AC | 4 ms
5,888 KB |
testcase_48 | AC | 5 ms
5,888 KB |
testcase_49 | AC | 4 ms
5,888 KB |
testcase_50 | AC | 5 ms
6,016 KB |
testcase_51 | AC | 5 ms
6,016 KB |
testcase_52 | AC | 5 ms
6,016 KB |
testcase_53 | AC | 5 ms
6,016 KB |
testcase_54 | AC | 4 ms
6,016 KB |
testcase_55 | AC | 4 ms
6,016 KB |
testcase_56 | AC | 4 ms
5,888 KB |
testcase_57 | AC | 4 ms
5,888 KB |
testcase_58 | AC | 5 ms
6,016 KB |
testcase_59 | AC | 4 ms
5,888 KB |
testcase_60 | AC | 4 ms
6,016 KB |
testcase_61 | AC | 5 ms
6,016 KB |
testcase_62 | AC | 4 ms
5,888 KB |
testcase_63 | AC | 19 ms
7,552 KB |
testcase_64 | AC | 8 ms
6,272 KB |
testcase_65 | AC | 12 ms
7,040 KB |
testcase_66 | AC | 11 ms
6,912 KB |
testcase_67 | AC | 6 ms
6,144 KB |
testcase_68 | AC | 11 ms
6,912 KB |
testcase_69 | AC | 15 ms
7,296 KB |
testcase_70 | AC | 8 ms
6,400 KB |
testcase_71 | AC | 7 ms
6,144 KB |
testcase_72 | AC | 14 ms
7,296 KB |
testcase_73 | AC | 7 ms
6,400 KB |
testcase_74 | AC | 14 ms
7,168 KB |
testcase_75 | AC | 12 ms
6,784 KB |
testcase_76 | AC | 5 ms
6,016 KB |
testcase_77 | AC | 10 ms
6,656 KB |
testcase_78 | AC | 17 ms
7,416 KB |
testcase_79 | AC | 17 ms
7,552 KB |
testcase_80 | AC | 16 ms
7,296 KB |
testcase_81 | AC | 19 ms
7,552 KB |
testcase_82 | AC | 17 ms
7,424 KB |
testcase_83 | AC | 223 ms
23,284 KB |
testcase_84 | AC | 218 ms
22,752 KB |
testcase_85 | AC | 119 ms
16,380 KB |
testcase_86 | AC | 183 ms
20,680 KB |
testcase_87 | AC | 209 ms
21,980 KB |
testcase_88 | AC | 27 ms
8,704 KB |
testcase_89 | AC | 245 ms
23,240 KB |
testcase_90 | AC | 128 ms
17,068 KB |
testcase_91 | AC | 94 ms
14,584 KB |
testcase_92 | AC | 46 ms
10,368 KB |
testcase_93 | AC | 163 ms
19,696 KB |
testcase_94 | AC | 145 ms
18,400 KB |
testcase_95 | AC | 145 ms
18,508 KB |
testcase_96 | AC | 202 ms
22,220 KB |
testcase_97 | AC | 75 ms
13,300 KB |
testcase_98 | AC | 189 ms
22,400 KB |
testcase_99 | AC | 108 ms
16,128 KB |
testcase_100 | AC | 231 ms
23,648 KB |
testcase_101 | AC | 42 ms
9,856 KB |
testcase_102 | AC | 22 ms
8,064 KB |
testcase_103 | AC | 46 ms
10,496 KB |
testcase_104 | AC | 66 ms
12,040 KB |
testcase_105 | AC | 160 ms
19,808 KB |
testcase_106 | AC | 88 ms
14,148 KB |
testcase_107 | AC | 207 ms
23,120 KB |
testcase_108 | AC | 212 ms
22,880 KB |
testcase_109 | AC | 165 ms
19,504 KB |
testcase_110 | AC | 147 ms
18,224 KB |
testcase_111 | AC | 161 ms
19,252 KB |
testcase_112 | AC | 63 ms
11,904 KB |
testcase_113 | AC | 142 ms
17,856 KB |
testcase_114 | AC | 83 ms
13,684 KB |
testcase_115 | AC | 30 ms
8,592 KB |
testcase_116 | AC | 100 ms
14,956 KB |
testcase_117 | AC | 64 ms
11,828 KB |
testcase_118 | AC | 202 ms
22,184 KB |
testcase_119 | AC | 109 ms
15,832 KB |
testcase_120 | AC | 196 ms
21,640 KB |
testcase_121 | AC | 52 ms
10,880 KB |
testcase_122 | AC | 94 ms
14,764 KB |
testcase_123 | AC | 3 ms
5,888 KB |
testcase_124 | AC | 162 ms
29,332 KB |
testcase_125 | AC | 157 ms
29,428 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define all(c) (c).begin(),(c).end() #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--) #define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++) #define iter(c) __typeof((c).begin()) #define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++) #define pb(a) push_back(a) #define pr(a) cout<<(a)<<endl #define PR(a,b) cout<<(a)<<" "<<(b)<<endl #define F first #define S second #define ll long long bool check(int n,int m,int x,int y){return (x<0||x>=n||y<0||y>=m)?false:true;} const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,-1,0,1}; typedef pair<int,int> P; int ord[100001],low[100001]; vector<int> G[100001]; struct edge{int u,v;}; void dfs(int u, int pre, int c, vector<int> G[], vector<edge> &B){ ord[u] = low[u] = c++; for(int i=0;i<G[u].size();i++){ int v = G[u][i]; if(v != pre){ if(ord[v] == -1){ dfs(v,u,c,G,B); low[u] = min(low[u],low[v]); } else low[u] = min(low[u],ord[v]); if(ord[u] < low[v]) B.push_back((edge){u,v}); } } } void bridge(int n, vector<int> G[], vector<edge> &B){ B.clear(); int c = 0; fill(ord,ord+n,-1); for(int i=0;i<n;i++) if(ord[i]==-1) dfs(i,-1,c,G,B); } int main() { int n,m; cin >> n; m = n; map<P, int> mp; int x[100010], y[100010]; rep(i,m) { cin >> x[i] >> y[i]; x[i]--; y[i]--; // mp[{x[i],y[i]}] = i; G[x[i]].pb(y[i]); G[y[i]].pb(x[i]); } vector<edge> E; bridge(n,G,E); vector<P> ans; rep(i,E.size()) { if(E[i].u>E[i].v) swap(E[i].u,E[i].v); ans.pb(P(E[i].u,E[i].v)); } sort(all(ans)); // rep(i,ans.size()) PR(ans[i].F,ans[i].S); rep(i,ans.size()){ mp[ans[i]]++; mp[{ans[i].S, ans[i].F}]++; } vector<int> ans2; rep(i,n){ if(mp[{x[i], y[i]}] == 0){ ans2.push_back(i+1); } } cout << ans2.size() << endl; for(auto &e: ans2) cout << e << " "; cout << endl; return 0; }