# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
897066 | ach00 | 별들과 삼각형 (IZhO11_triangle) | C++14 | 422 ms | 19804 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define X second
#define Y first
int main() {
vector<pair<long long,long long>> stars;
map<long long, int> x_count;
map<long long, int> y_count;
int n; cin >> n;
for(int i = 0; i < n; i++) {
int x,y; cin >> x >> y;
stars.push_back({y,x});
x_count[x]++;
y_count[y]++;
}
long long ans = 0;
for(int i = 0; i < n; i++) {
ans += max((x_count[stars[i].X]-1),0)*max((y_count[stars[i].Y]-1),0);
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |