結果
問題 | No.1254 補強への架け橋 |
ユーザー | cn_449 |
提出日時 | 2020-10-09 23:43:52 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 305 ms / 2,000 ms |
コード長 | 2,614 bytes |
コンパイル時間 | 1,511 ms |
コンパイル使用メモリ | 145,128 KB |
実行使用メモリ | 30,080 KB |
最終ジャッジ日時 | 2024-07-20 14:35:30 |
合計ジャッジ時間 | 14,316 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4 ms
6,016 KB |
testcase_01 | AC | 4 ms
6,016 KB |
testcase_02 | AC | 4 ms
5,888 KB |
testcase_03 | AC | 4 ms
6,016 KB |
testcase_04 | AC | 4 ms
6,016 KB |
testcase_05 | AC | 3 ms
6,016 KB |
testcase_06 | AC | 4 ms
5,888 KB |
testcase_07 | AC | 3 ms
6,016 KB |
testcase_08 | AC | 4 ms
6,016 KB |
testcase_09 | AC | 4 ms
5,888 KB |
testcase_10 | AC | 4 ms
6,016 KB |
testcase_11 | AC | 4 ms
6,016 KB |
testcase_12 | AC | 4 ms
6,016 KB |
testcase_13 | AC | 4 ms
6,016 KB |
testcase_14 | AC | 3 ms
6,016 KB |
testcase_15 | AC | 3 ms
5,888 KB |
testcase_16 | AC | 4 ms
5,888 KB |
testcase_17 | AC | 4 ms
6,016 KB |
testcase_18 | AC | 4 ms
6,016 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
5,888 KB |
testcase_23 | AC | 4 ms
6,016 KB |
testcase_24 | AC | 4 ms
6,016 KB |
testcase_25 | AC | 4 ms
5,888 KB |
testcase_26 | AC | 4 ms
5,888 KB |
testcase_27 | AC | 4 ms
6,016 KB |
testcase_28 | AC | 4 ms
5,888 KB |
testcase_29 | AC | 4 ms
6,016 KB |
testcase_30 | AC | 4 ms
6,016 KB |
testcase_31 | AC | 4 ms
6,016 KB |
testcase_32 | AC | 4 ms
6,016 KB |
testcase_33 | AC | 4 ms
6,016 KB |
testcase_34 | AC | 4 ms
6,016 KB |
testcase_35 | AC | 4 ms
6,016 KB |
testcase_36 | AC | 4 ms
6,016 KB |
testcase_37 | AC | 4 ms
5,888 KB |
testcase_38 | AC | 4 ms
5,888 KB |
testcase_39 | AC | 4 ms
5,888 KB |
testcase_40 | AC | 3 ms
5,888 KB |
testcase_41 | AC | 3 ms
6,144 KB |
testcase_42 | AC | 4 ms
6,016 KB |
testcase_43 | AC | 4 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,144 KB |
testcase_47 | AC | 4 ms
6,016 KB |
testcase_48 | AC | 3 ms
6,144 KB |
testcase_49 | AC | 4 ms
5,888 KB |
testcase_50 | AC | 4 ms
6,144 KB |
testcase_51 | AC | 5 ms
6,144 KB |
testcase_52 | AC | 4 ms
6,144 KB |
testcase_53 | AC | 4 ms
6,144 KB |
testcase_54 | AC | 4 ms
6,144 KB |
testcase_55 | AC | 5 ms
6,144 KB |
testcase_56 | AC | 4 ms
6,016 KB |
testcase_57 | AC | 4 ms
6,016 KB |
testcase_58 | AC | 4 ms
6,272 KB |
testcase_59 | AC | 4 ms
6,016 KB |
testcase_60 | AC | 4 ms
6,016 KB |
testcase_61 | AC | 4 ms
6,144 KB |
testcase_62 | AC | 3 ms
6,016 KB |
testcase_63 | AC | 13 ms
7,424 KB |
testcase_64 | AC | 6 ms
6,400 KB |
testcase_65 | AC | 9 ms
7,040 KB |
testcase_66 | AC | 8 ms
6,784 KB |
testcase_67 | AC | 5 ms
6,272 KB |
testcase_68 | AC | 8 ms
7,040 KB |
testcase_69 | AC | 10 ms
7,168 KB |
testcase_70 | AC | 7 ms
6,528 KB |
testcase_71 | AC | 5 ms
6,400 KB |
testcase_72 | AC | 10 ms
7,040 KB |
testcase_73 | AC | 6 ms
6,400 KB |
testcase_74 | AC | 10 ms
7,040 KB |
testcase_75 | AC | 7 ms
6,656 KB |
testcase_76 | AC | 5 ms
6,144 KB |
testcase_77 | AC | 7 ms
6,656 KB |
testcase_78 | AC | 12 ms
7,424 KB |
testcase_79 | AC | 12 ms
7,424 KB |
testcase_80 | AC | 12 ms
7,168 KB |
testcase_81 | AC | 12 ms
7,424 KB |
testcase_82 | AC | 11 ms
7,296 KB |
testcase_83 | AC | 161 ms
20,736 KB |
testcase_84 | AC | 148 ms
20,352 KB |
testcase_85 | AC | 76 ms
14,976 KB |
testcase_86 | AC | 142 ms
18,432 KB |
testcase_87 | AC | 142 ms
19,584 KB |
testcase_88 | AC | 18 ms
8,192 KB |
testcase_89 | AC | 142 ms
20,608 KB |
testcase_90 | AC | 88 ms
15,488 KB |
testcase_91 | AC | 64 ms
13,568 KB |
testcase_92 | AC | 31 ms
9,856 KB |
testcase_93 | AC | 119 ms
17,792 KB |
testcase_94 | AC | 100 ms
16,640 KB |
testcase_95 | AC | 101 ms
16,640 KB |
testcase_96 | AC | 134 ms
19,840 KB |
testcase_97 | AC | 53 ms
12,416 KB |
testcase_98 | AC | 131 ms
19,968 KB |
testcase_99 | AC | 73 ms
14,464 KB |
testcase_100 | AC | 164 ms
20,992 KB |
testcase_101 | AC | 28 ms
9,600 KB |
testcase_102 | AC | 15 ms
7,808 KB |
testcase_103 | AC | 30 ms
9,984 KB |
testcase_104 | AC | 42 ms
11,264 KB |
testcase_105 | AC | 108 ms
17,792 KB |
testcase_106 | AC | 55 ms
13,056 KB |
testcase_107 | AC | 149 ms
20,608 KB |
testcase_108 | AC | 157 ms
20,352 KB |
testcase_109 | AC | 115 ms
17,664 KB |
testcase_110 | AC | 104 ms
16,384 KB |
testcase_111 | AC | 119 ms
17,280 KB |
testcase_112 | AC | 42 ms
11,136 KB |
testcase_113 | AC | 100 ms
16,128 KB |
testcase_114 | AC | 59 ms
12,800 KB |
testcase_115 | AC | 20 ms
8,448 KB |
testcase_116 | AC | 68 ms
13,824 KB |
testcase_117 | AC | 46 ms
11,264 KB |
testcase_118 | AC | 175 ms
19,840 KB |
testcase_119 | AC | 92 ms
14,336 KB |
testcase_120 | AC | 168 ms
19,328 KB |
testcase_121 | AC | 38 ms
10,496 KB |
testcase_122 | AC | 78 ms
13,696 KB |
testcase_123 | AC | 5 ms
6,016 KB |
testcase_124 | AC | 305 ms
30,080 KB |
testcase_125 | AC | 226 ms
30,080 KB |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <string> #include <queue> #include <stack> #include <set> #include <map> #include <iomanip> #include <utility> #include <tuple> #include <functional> #include <bitset> #include <cassert> #include <complex> #include <stdio.h> #include <time.h> #include <numeric> #include <random> #include <unordered_map> #include <unordered_set> #define all(a) a.begin(),a.end() #define rep(i, n) for (ll i = 0; i < (n); i++) #define pb push_back #define debug(x) cerr << __LINE__ << ' ' << #x << ':' << (x) << '\n' #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef long double ld; typedef pair<ll, ll> P; typedef complex<ld> com; template<class T> using prique = priority_queue<T, vector<T>, greater<T>>; constexpr int inf = 1000000010; constexpr ll INF = 1000000000000000010; constexpr int mod1e9 = 1000000007; constexpr int mod998 = 998244353; constexpr ld eps = 1e-12; constexpr ld pi = 3.141592653589793238; constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; }; int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 }; void fail() { cout << "-1\n"; exit(0); } void no() { cout << "No\n"; exit(0); } template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; } template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; } template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; } template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; } struct fastio { fastio() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); cerr << fixed << setprecision(20); } }fastio_; const int N = ten(5) + 10; vector<vector<int>> graph(N, vector<int>()); vector<int> par(N); vector<bool> used(N); int x, y; void dfs(int n, int p) { used[n] = true; par[n] = p; for (int i : graph[n]) { if (i == p) continue; if (used[i]) x = n, y = i; else dfs(i, n); } } int main() { int n; cin >> n; map<P, int> mp; rep(i, n) { int u, v; cin >> u >> v; u--; v--; graph[u].pb(v); graph[v].pb(u); mp[{u, v}] = i + 1; mp[{v, u}] = i + 1; } dfs(0, -1); vector<int> ans; ans.pb(mp[{x, y}]); while (x != y) { ans.pb(mp[{y, par[y]}]); y = par[y]; } cout << ans.size() << '\n'; for (int i : ans) cout << i << ' '; cout << '\n'; }