# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
379680 | SolarSystem | 별들과 삼각형 (IZhO11_triangle) | C++17 | 502 ms | 18156 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <stdio.h>
#include <numeric>
#include <iomanip>
#include <random>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<pair<long long, long long>> pts(n);
for (int i = 0; i < n; i++) {
cin >> pts[i].first >> pts[i].second;
}
map<long long, long long> mpx;
map<long long, vector<long long>> mpy;
for (int i = 0; i < n; i++) {
mpx[pts[i].first]++;
mpy[pts[i].second].push_back(pts[i].first);
}
long long ans = 0;
for (auto e: mpy) {
long long curr = 0;
for (auto u: e.second) {
curr += mpx[u] - 1;
}
curr *= ((int) e.second.size() - 1);
ans += curr;
}
cout << ans << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |