Submission #65016528


Source Code Expand

Copy
#ifndef _Alignof
#define _Alignof __alignof__
#endif
#include <bits/stdc++.h>
#include <numeric>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
#define yes "Yes"
#define no "No"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
const vector<char> alpha = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#ifndef _Alignof
#define _Alignof __alignof__
#endif
#include <bits/stdc++.h>
#include <numeric>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
#define yes "Yes"
#define no "No"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
const vector<char> alpha = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
const ll INF = 1e18;

int main() {
    int N, M;
    if (!(cin >> N >> M)) return 0;
    
    vector<ll> cnt(N, 0);
    
    REP(i,M) {
        int a, b;
        cin >> a >> b;
        if (a > b) swap(a, b);
        int key = (a + b) % N;  
        cnt[key]++;
    }
    
    ll total = M * (M - 1) / 2;
    ll parallel = 0;
    REP(i, N) {
        if (cnt[i] > 1)
            parallel += cnt[i] * (cnt[i] - 1) / 2; 
    }
    cout << total - parallel << '\n';
    return 0;
}

Submission Info

Submission Time
Task D - Line Crossing
User una_o0
Language C++ 17 (gcc 12.2)
Score 0
Code Size 1294 Byte
Status WA
Exec Time 136 ms
Memory 11088 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
AC × 14
WA × 20
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3460 KiB
00_sample_01.txt AC 1 ms 3564 KiB
01_test_00.txt AC 1 ms 3500 KiB
01_test_01.txt WA 16 ms 3468 KiB
01_test_02.txt AC 2 ms 3520 KiB
01_test_03.txt WA 17 ms 3368 KiB
01_test_04.txt AC 2 ms 3372 KiB
01_test_05.txt WA 36 ms 9760 KiB
01_test_06.txt WA 135 ms 10288 KiB
01_test_07.txt WA 121 ms 5404 KiB
01_test_08.txt AC 2 ms 3692 KiB
01_test_09.txt AC 22 ms 7332 KiB
01_test_10.txt WA 133 ms 8916 KiB
01_test_11.txt WA 43 ms 8864 KiB
01_test_12.txt AC 6 ms 11036 KiB
01_test_13.txt WA 123 ms 11024 KiB
01_test_14.txt WA 136 ms 11028 KiB
01_test_15.txt WA 65 ms 10984 KiB
01_test_16.txt AC 5 ms 10996 KiB
01_test_17.txt WA 113 ms 10988 KiB
01_test_18.txt WA 38 ms 8736 KiB
01_test_19.txt WA 38 ms 6532 KiB
01_test_20.txt WA 57 ms 4436 KiB
01_test_21.txt WA 75 ms 11048 KiB
01_test_22.txt WA 62 ms 10984 KiB
01_test_23.txt WA 56 ms 6036 KiB
01_test_24.txt AC 10 ms 10188 KiB
01_test_25.txt WA 68 ms 6236 KiB
01_test_26.txt AC 12 ms 10980 KiB
01_test_27.txt WA 80 ms 11088 KiB
01_test_28.txt AC 1 ms 3440 KiB
01_test_29.txt AC 1 ms 3496 KiB
01_test_30.txt AC 1 ms 3428 KiB
01_test_31.txt WA 70 ms 3572 KiB


2025-06-06 (Fri)
18:28:38 +09:00