Submission #65015239
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<int> A(M) ,B(M);
map<int,ll> cnt;
REP(i,M) {
cin >> A[i] >> B[i];
cnt[A[i]+B[i]]++;
}
ll ans=M*(M-1)/2;
for (auto [k,v] : cnt) {
ans -= v*(v-1)/2;
if (cnt.count(k+N)){
ans -= v*cnt[k+N];
}
}
cout << ans << endl;
}
Submission Info
| Submission Time |
|
| Task |
D - Line Crossing |
| User |
una_o0 |
| Language |
C++ 17 (gcc 12.2) |
| Score |
0 |
| Code Size |
1185 Byte |
| Status |
WA |
| Exec Time |
245 ms |
| Memory |
22432 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
0 / 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 |
3528 KiB |
| 00_sample_01.txt |
AC |
1 ms |
3356 KiB |
| 01_test_00.txt |
AC |
1 ms |
3540 KiB |
| 01_test_01.txt |
WA |
18 ms |
3628 KiB |
| 01_test_02.txt |
AC |
2 ms |
3500 KiB |
| 01_test_03.txt |
WA |
21 ms |
3632 KiB |
| 01_test_04.txt |
AC |
1 ms |
3496 KiB |
| 01_test_05.txt |
WA |
51 ms |
8128 KiB |
| 01_test_06.txt |
WA |
240 ms |
22320 KiB |
| 01_test_07.txt |
WA |
220 ms |
19152 KiB |
| 01_test_08.txt |
AC |
1 ms |
3516 KiB |
| 01_test_09.txt |
AC |
30 ms |
6216 KiB |
| 01_test_10.txt |
WA |
245 ms |
21912 KiB |
| 01_test_11.txt |
WA |
63 ms |
9144 KiB |
| 01_test_12.txt |
AC |
2 ms |
3552 KiB |
| 01_test_13.txt |
WA |
212 ms |
20484 KiB |
| 01_test_14.txt |
WA |
243 ms |
22432 KiB |
| 01_test_15.txt |
WA |
101 ms |
12372 KiB |
| 01_test_16.txt |
AC |
1 ms |
3520 KiB |
| 01_test_17.txt |
WA |
193 ms |
19504 KiB |
| 01_test_18.txt |
WA |
55 ms |
8596 KiB |
| 01_test_19.txt |
WA |
60 ms |
9188 KiB |
| 01_test_20.txt |
WA |
115 ms |
13880 KiB |
| 01_test_21.txt |
WA |
121 ms |
14476 KiB |
| 01_test_22.txt |
WA |
98 ms |
12284 KiB |
| 01_test_23.txt |
WA |
56 ms |
4516 KiB |
| 01_test_24.txt |
AC |
6 ms |
3608 KiB |
| 01_test_25.txt |
WA |
66 ms |
4708 KiB |
| 01_test_26.txt |
AC |
8 ms |
3624 KiB |
| 01_test_27.txt |
WA |
77 ms |
5020 KiB |
| 01_test_28.txt |
AC |
1 ms |
3648 KiB |
| 01_test_29.txt |
AC |
1 ms |
3488 KiB |
| 01_test_30.txt |
AC |
1 ms |
3532 KiB |
| 01_test_31.txt |
WA |
81 ms |
5444 KiB |