| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 465909 | JasperL | 별들과 삼각형 (IZhO11_triangle) | C++14 | 572 ms | 12488 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <set>
#include <map>
#include <vector>
using namespace std;
#define maxn 300005
typedef long long ll;
int n, c;
int z[maxn][2];
set<int> s;
map<int,int> mp;
ll ans = 0;
int x[2*maxn], y[2*maxn];
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> z[i][0] >> z[i][1];
s.insert(z[i][0]), s.insert(z[i][1]);
}
for (int t : s) mp[t] = c++;
for (int i = 0; i < n; i++) z[i][0] = mp[z[i][0]], z[i][1] = mp[z[i][1]], x[z[i][0]]++, y[z[i][1]]++;
for (int i = 0; i < n; i++) {
ans += (ll)(x[z[i][0]] - 1) * (ll)(y[z[i][1]] - 1);
}
cout << ans << endl;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
