Submission #62806756


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define F first
#define S second
#define endl '\n'
const int N1 = 500005,N2=200005;
map<int, vector<int>> mmap;
int ans,ans2;
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, m;
cin >> n >> m;
for (int i = 1; i <= m; i++)
{
int a, b;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define F first
#define S second
#define endl '\n'
const int N1 = 500005,N2=200005;
map<int, vector<int>> mmap;
int ans,ans2;
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= m; i++)
    {
        int a, b;
        cin >> a >> b;
        if(a==b){
            ans++;
            // cout << "ans=" << ans << endl;
            continue;
        }
        mmap[a].push_back(b);
        mmap[b].push_back(a);
    }
    for (auto i : mmap)
    {

        int size = i.S.size();
        sort(i.S.begin(), i.S.end());
        // for(int j=0;j<size;j++){
        //     cout << "i=" << i.F << " " << "i.S[j]=" << i.S[j] << endl;
        // }
        for (int j = 0; j < size - 1; j++)
        {
            if (i.S[j] == i.S[j + 1])
            {
                ans2++;
                // cout <<"i="<<i.F<<" "<<"same="<<i.S[j]<<" "<< "ans2=" << ans2 << endl;
            }
        }
    }
    ans += ans2 / 2;
    cout << ans;
    return 0;
}

Submission Info

Submission Time
Task C - Make it Simple
User hujishi
Language C++ 23 (gcc 12.2)
Score 300
Code Size 1198 Byte
Status AC
Exec Time 447 ms
Memory 29412 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 19
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_n_small_00.txt, 01_n_small_01.txt, 01_n_small_02.txt, 01_n_small_03.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 03_corner_00.txt, 03_corner_01.txt, 03_corner_02.txt, 03_corner_03.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3428 KB
00_sample_01.txt AC 1 ms 3628 KB
00_sample_02.txt AC 1 ms 3500 KB
01_n_small_00.txt AC 62 ms 7000 KB
01_n_small_01.txt AC 50 ms 6568 KB
01_n_small_02.txt AC 81 ms 7672 KB
01_n_small_03.txt AC 45 ms 6820 KB
02_random_00.txt AC 239 ms 21964 KB
02_random_01.txt AC 255 ms 25000 KB
02_random_02.txt AC 421 ms 27424 KB
02_random_03.txt AC 447 ms 29412 KB
02_random_04.txt AC 356 ms 27204 KB
02_random_05.txt AC 263 ms 25100 KB
02_random_06.txt AC 394 ms 25956 KB
02_random_07.txt AC 435 ms 29348 KB
03_corner_00.txt AC 253 ms 26776 KB
03_corner_01.txt AC 411 ms 27800 KB
03_corner_02.txt AC 47 ms 4544 KB
03_corner_03.txt AC 42 ms 3368 KB


2025-04-11 (Fri)
20:49:23 +00:00