結果
問題 | No.3107 Listening |
ユーザー | Pechi |
提出日時 | 2024-04-01 22:02:44 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,320 ms / 2,000 ms |
コード長 | 2,176 bytes |
コンパイル時間 | 4,839 ms |
コンパイル使用メモリ | 275,208 KB |
実行使用メモリ | 18,620 KB |
最終ジャッジ日時 | 2024-09-30 22:27:03 |
合計ジャッジ時間 | 37,042 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 3 ms
5,248 KB |
testcase_02 | AC | 3 ms
5,248 KB |
testcase_03 | AC | 512 ms
8,064 KB |
testcase_04 | AC | 109 ms
5,248 KB |
testcase_05 | AC | 156 ms
8,320 KB |
testcase_06 | AC | 109 ms
5,248 KB |
testcase_07 | AC | 381 ms
10,752 KB |
testcase_08 | AC | 234 ms
9,856 KB |
testcase_09 | AC | 294 ms
7,168 KB |
testcase_10 | AC | 440 ms
5,248 KB |
testcase_11 | AC | 623 ms
6,144 KB |
testcase_12 | AC | 257 ms
9,472 KB |
testcase_13 | AC | 557 ms
8,064 KB |
testcase_14 | AC | 314 ms
9,984 KB |
testcase_15 | AC | 175 ms
5,248 KB |
testcase_16 | AC | 116 ms
6,528 KB |
testcase_17 | AC | 164 ms
9,600 KB |
testcase_18 | AC | 57 ms
5,248 KB |
testcase_19 | AC | 394 ms
7,808 KB |
testcase_20 | AC | 389 ms
5,248 KB |
testcase_21 | AC | 836 ms
10,240 KB |
testcase_22 | AC | 544 ms
6,656 KB |
testcase_23 | AC | 772 ms
10,752 KB |
testcase_24 | AC | 585 ms
5,248 KB |
testcase_25 | AC | 483 ms
10,752 KB |
testcase_26 | AC | 160 ms
8,960 KB |
testcase_27 | AC | 289 ms
5,248 KB |
testcase_28 | AC | 594 ms
7,296 KB |
testcase_29 | AC | 674 ms
9,856 KB |
testcase_30 | AC | 304 ms
9,984 KB |
testcase_31 | AC | 368 ms
9,600 KB |
testcase_32 | AC | 550 ms
8,320 KB |
testcase_33 | AC | 1,239 ms
18,492 KB |
testcase_34 | AC | 1,171 ms
18,364 KB |
testcase_35 | AC | 1,165 ms
18,620 KB |
testcase_36 | AC | 1,159 ms
18,488 KB |
testcase_37 | AC | 1,164 ms
18,488 KB |
testcase_38 | AC | 1,157 ms
18,492 KB |
testcase_39 | AC | 1,188 ms
18,492 KB |
testcase_40 | AC | 1,320 ms
18,496 KB |
testcase_41 | AC | 1,174 ms
18,492 KB |
testcase_42 | AC | 1,200 ms
18,616 KB |
ソースコード
#define _USE_MATH_DEFINES #pragma GCC target("avx2") #pragma GCC optimize("O3") #include<bits/stdc++.h> #include<unordered_set> #include<random> #include <array> #include <complex> #include<chrono> //#include <atcoder/all> using namespace std; //using namespace atcoder; #define LP(I,S,G) for (long long int I = (S); I < (G); ++I) #define IN(X) for (int in = 0; in < X.size(); in++)cin >> X[in] #define OUT(X) for (int in = 0; in < X.size(); in++)cout << X[in]<<" " #define SORT(X) sort((X).begin(), (X).end()) #define CSORT(X,Y) sort(X.begin(), X.end(),Y) #define COPY(X,Y) copy(X.begin(), X.end(), Y.begin()) #define ALL(X,Y) for (auto &(X) :(Y)) #define FULL(a) (a).begin(),(a).end() #define BFS(Q,S) for(Q.push(S);Q.size()!=0;Q.pop()) typedef long long int ll; typedef unsigned long long int ull; long long int M = 998244353; chrono::system_clock::time_point starttime; using namespace std::chrono; inline float getTime() { return duration_cast<milliseconds>(system_clock::now() - starttime).count(); } int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 }; ll MAX(ll A, ll B) { return ((A) > (B) ? (A) : (B)); } ll MIN(ll A, ll B) { return ((A) < (B) ? (A) : (B)); } inline long long int xor128() { static long long int x = 123456789, y = 362436069, z = 521288629, w = 88675123; long long int t = (x ^ (x << 11)); x = y; y = z; z = w; return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))); } ll f(ll n, map<ll, ll>& dp) { if (dp.find(n) != dp.end())return dp[n]; dp[n] = f(n / 2, dp) + f(n / 3, dp); return dp[n]; } /* An undirected, simple connected graph G has n vertices and m edges. The vertices are numbered from 1 to n, and the i-th edge joins the u-th and v-th vertices. Find a subset of edges which form a maximal matching of G. */ int main() { ll n, m; cin >> n >> m; vector<vector<ll>> g(n); set<ll> s, t, o; vector<ll> ans; for (int i = 0; i < n; ++i)o.insert(i); LP(i, 0, m) { ll u, v; cin >> u >> v; --u, --v; if (o.find(u) != o.end() && o.find(v) != o.end()) { o.erase(u); o.erase(v); s.insert(u); t.insert(v); ans.push_back(i + 1); } } cout << ans.size() << "\n"; LP(i, 0, ans.size())cout << ans[i] << "\n"; return 0; }