6218 | 2023-11-08 10:47:40 | Error42 | Csodálatos Csillagképek | cpp17 | Accepted 100/100 | 722ms | 92180 KiB |
// Code of EsVagy, only corrected by Error42
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
struct star
{
int x, y;
};
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
map<int, set<int>> rows;
map<int, set<int>> cols;
vector<star> stars;
int t;
cin >> t;
for (int i = 0; i < t; i++)
{
star s;
cin >> s.x >> s.y;
stars.push_back(s);
rows[s.y].insert(s.x);
cols[s.x].insert(s.y);
}
long int ans = 0;
for (star s : stars)
{
ans += (rows[s.y].size() - 1) * (cols[s.x].size() - 1);
}
cout << ans << "\n";
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1828 KiB | ||||
subtask2 | 25/25 | ||||||
2 | Accepted | 3ms | 2212 KiB | ||||
3 | Accepted | 3ms | 2536 KiB | ||||
4 | Accepted | 3ms | 2780 KiB | ||||
5 | Accepted | 3ms | 2932 KiB | ||||
subtask3 | 40/40 | ||||||
6 | Accepted | 4ms | 3336 KiB | ||||
7 | Accepted | 4ms | 3500 KiB | ||||
8 | Accepted | 3ms | 3588 KiB | ||||
9 | Accepted | 4ms | 3556 KiB | ||||
10 | Accepted | 3ms | 3508 KiB | ||||
11 | Accepted | 4ms | 4052 KiB | ||||
subtask4 | 35/35 | ||||||
12 | Accepted | 43ms | 14376 KiB | ||||
13 | Accepted | 695ms | 90048 KiB | ||||
14 | Accepted | 263ms | 49760 KiB | ||||
15 | Accepted | 67ms | 20916 KiB | ||||
16 | Accepted | 97ms | 28644 KiB | ||||
17 | Accepted | 435ms | 74000 KiB | ||||
18 | Accepted | 104ms | 30076 KiB | ||||
19 | Accepted | 143ms | 36784 KiB | ||||
20 | Accepted | 680ms | 88860 KiB | ||||
21 | Accepted | 722ms | 92180 KiB |