| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1343858 | nicolo_010 | 별들과 삼각형 (IZhO11_triangle) | C++20 | 775 ms | 24624 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
map<int, int> rows, col;
map<pii, int> mp;
vector<pii> a(n);
for (int i=0; i<n; i++) {
cin >> a[i].first >> a[i].second;
auto [x, y] = a[i];
mp[a[i]]++;
rows[x]++;
col[y]++;
}
ll ans=0;
for (int i=0; i<n; i++) {
auto [x, y] = a[i];
int r = rows[x];
int c = col[y];
ans += (r-1)*(c-1);
}
cout << ans << "\n";
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
