| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 745448 | Alexandruabcde | Marshmallow Molecules (CCO19_day2problem2) | C++14 | 4106 ms | 826896 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef pair <int, int> PII;
constexpr int NMAX = 1e5 + 5;
int N, M;
vector <int> G[NMAX];
map <PII, int> mp;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N >> M;
    for (int i = 1; i <= M; ++ i ) {
        int x, y;
        cin >> x >> y;
        if (x > y) swap(x, y);
        G[x].push_back(y);
        mp[{x, y}] = true;
    }
    for (int i = 1; i <= N; ++ i ) {
        sort(G[i].begin(), G[i].end());
        if (G[i].empty()) continue;
        int x = G[i][0];
        for (int j = 1; j < G[i].size(); ++ j ) {
            int y = G[i][j];
            if (!mp[{x, y}]) {
                G[x].push_back(y);
                mp[{x, y}] = true;
            }
        }
    }
    cout << mp.size() << '\n';
    return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
