# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
877825 | __Davit__ | Star triangles (IZhO11_triangle) | C++17 | 1 ms | 2140 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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... |