# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
331104 | AlexLuchianov | 별들과 삼각형 (IZhO11_triangle) | C++14 | 363 ms | 5868 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <map>
using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
std::map<int,int> frecx, frecy;
int const nmax = 300000;
int v[1 + nmax][2];
int main() {
std::ios::sync_with_stdio(0);
std::cin.tie(0);
int n;
std::cin >> n;
for(int i = 1;i <= n; i++)
std::cin >> v[i][0] >> v[i][1];
for(int i = 1;i <= n; i++) {
frecx[v[i][0]]++;
frecy[v[i][1]]++;
}
ll result = 0;
for(int i = 1;i <= n; i++)
result += 1LL * (frecx[v[i][0]] - 1) * (frecy[v[i][1]] - 1);
std::cout << result;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |