提出 #62764193


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define str string
#define ull unsigned long long

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pair<ll, ll>> v2ll;
typedef vector<bool> vb;

#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define F0R(i, a) for(int i=0; i<(a); i++)
#define FORd(i,a,b) for(int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for(int i = (a)-1; i >= 0; i--)

const ll seed = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(seed);

struct customMapHash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        return splitmix64(x + seed);
    }
};

#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);
void pmin(ll& a, ll b) {a = min(a, b);};
void pmax(ll& a, ll b) {a = max(a, b);};

#define INF(dtype) numeric_limits<dtype>::max()
#define NINF(dtype) numeric_limits<dtype>::min()

const ll MOD = 1E7 + 1;
const char nl = '\n';
const char sp = ' ';

void YoN(bool ans) {
    cout << (ans?"YES":"NO");
}

void tc(int testCaseNo) {
    ll n, m; cin >> n >> m;
    ll ans = 0;
    set<pair<ll, ll>> edges;

    F0R(i, m) {
        ll a, b; cin >> a >> b;
        if(a < b) swap(a, b);
        if (a == b || edges.find(mp(a, b)) != edges.end()) {
            ans++;
        } else {
            edges.emplace(mp(a, b));
        }
    }
    cout << ans;
}

int main() {
    fastIO

    int t = 1;
    // cin >> t;
    F0R(i, t) {
        tc(i+1);
        cout << nl;
    }
}

提出情報

提出日時
問題 C - Make it Simple
ユーザ JaSonic
言語 C++ 23 (gcc 12.2)
得点 300
コード長 1936 Byte
結果 AC
実行時間 523 ms
メモリ 34740 KiB

コンパイルエラー

Main.cpp: In function ‘void tc(int)’:
Main.cpp:56:13: warning: unused parameter ‘testCaseNo’ [-Wunused-parameter]
   56 | void tc(int testCaseNo) {
      |         ~~~~^~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 19
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3528 KiB
00_sample_01.txt AC 1 ms 3444 KiB
00_sample_02.txt AC 1 ms 3488 KiB
01_n_small_00.txt AC 42 ms 3388 KiB
01_n_small_01.txt AC 34 ms 3388 KiB
01_n_small_02.txt AC 55 ms 3492 KiB
01_n_small_03.txt AC 34 ms 3320 KiB
02_random_00.txt AC 256 ms 22044 KiB
02_random_01.txt AC 252 ms 21540 KiB
02_random_02.txt AC 510 ms 34732 KiB
02_random_03.txt AC 499 ms 34736 KiB
02_random_04.txt AC 393 ms 30060 KiB
02_random_05.txt AC 252 ms 22020 KiB
02_random_06.txt AC 506 ms 34740 KiB
02_random_07.txt AC 523 ms 34736 KiB
03_corner_00.txt AC 231 ms 19160 KiB
03_corner_01.txt AC 367 ms 19104 KiB
03_corner_02.txt AC 45 ms 3752 KiB
03_corner_03.txt AC 44 ms 3548 KiB