Submission #65029793
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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;
cin >> N >> M;
vector<ll> cnt(N, 0);
ll total=1LL*M*(M-1)/2;
REP(i,M){
int a, b;
cin >> a >> b;
if (a > b) swap(a, b);
int key = (a + b) % N;
total-= cnt[key];
cnt[key]++;
}
cout << total << endl;
}
Submission Info
| Submission Time |
|
| Task |
D - Line Crossing |
| User |
una_o0 |
| Language |
C++ 17 (gcc 12.2) |
| Score |
400 |
| Code Size |
1145 Byte |
| Status |
AC |
| Exec Time |
130 ms |
| Memory |
11152 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
400 / 400 |
| Status |
|
|
| 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 |
3608 KiB |
| 00_sample_01.txt |
AC |
1 ms |
3524 KiB |
| 01_test_00.txt |
AC |
1 ms |
3544 KiB |
| 01_test_01.txt |
AC |
15 ms |
3536 KiB |
| 01_test_02.txt |
AC |
2 ms |
3476 KiB |
| 01_test_03.txt |
AC |
17 ms |
3540 KiB |
| 01_test_04.txt |
AC |
1 ms |
3476 KiB |
| 01_test_05.txt |
AC |
31 ms |
9832 KiB |
| 01_test_06.txt |
AC |
114 ms |
10240 KiB |
| 01_test_07.txt |
AC |
108 ms |
5532 KiB |
| 01_test_08.txt |
AC |
1 ms |
3756 KiB |
| 01_test_09.txt |
AC |
21 ms |
7368 KiB |
| 01_test_10.txt |
AC |
116 ms |
8904 KiB |
| 01_test_11.txt |
AC |
37 ms |
9108 KiB |
| 01_test_12.txt |
AC |
4 ms |
10996 KiB |
| 01_test_13.txt |
AC |
112 ms |
11152 KiB |
| 01_test_14.txt |
AC |
130 ms |
10976 KiB |
| 01_test_15.txt |
AC |
56 ms |
10996 KiB |
| 01_test_16.txt |
AC |
4 ms |
11144 KiB |
| 01_test_17.txt |
AC |
100 ms |
11000 KiB |
| 01_test_18.txt |
AC |
34 ms |
8768 KiB |
| 01_test_19.txt |
AC |
34 ms |
6492 KiB |
| 01_test_20.txt |
AC |
54 ms |
4492 KiB |
| 01_test_21.txt |
AC |
70 ms |
11036 KiB |
| 01_test_22.txt |
AC |
56 ms |
11016 KiB |
| 01_test_23.txt |
AC |
55 ms |
6016 KiB |
| 01_test_24.txt |
AC |
8 ms |
10284 KiB |
| 01_test_25.txt |
AC |
67 ms |
6232 KiB |
| 01_test_26.txt |
AC |
11 ms |
11064 KiB |
| 01_test_27.txt |
AC |
79 ms |
11076 KiB |
| 01_test_28.txt |
AC |
1 ms |
3448 KiB |
| 01_test_29.txt |
AC |
1 ms |
3448 KiB |
| 01_test_30.txt |
AC |
1 ms |
3672 KiB |
| 01_test_31.txt |
AC |
71 ms |
3616 KiB |