# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
877825 | __Davit__ | 별들과 삼각형 (IZhO11_triangle) | C++17 | 1 ms | 2140 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define lld long double
#define ff first
#define ss second
#define pb push_back
#define vr(v) v.begin(),v.end()
#define rv(v) v.rbegin(),v.rend()
#define Code ios_base::sync_with_stdio(false);
#define By cin.tie(NULL);
#define Davit cout.tie(NULL);
#define FOR(i, n) for(int i = 0;i<n;i++)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
//#include "algo/debug.h"
int main() {
Code
By
Davit
int n;
cin >> n;
vector<int> X(100005), Y(100005);
vector<pair<int, int>> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i].ff >> v[i].ss;
X[v[i].ff]++;
Y[v[i].ss]++;
}
ll ans = 0;
for (int i = 0; i < n; i++) {
int x = v[i].ff, y = v[i].ss;
ans += 1ll * (X[x] - 1) * (Y[y] - 1);
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |