# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
970897 | saidpon | Star triangles (IZhO11_triangle) | C++17 | 2054 ms | 8596 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 ordered_set tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define nemeshay ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define allr(pon) pon.rbegin(), pon.rend()
#include <ext/pb_ds/assoc_container.hpp>
#define all(pon) pon.begin(), pon.end()
#include <ext/pb_ds/tree_policy.hpp>
#define pii pair <int, int>
#define nosolve puts("-1")
#define YES puts("YES")
#define pf push_front
#define int long long
#define OK puts("OK")
#define NO puts("NO")
#define pb push_back
#define sigma signed
#define sc second
#define fr first
using namespace __gnu_pbds;
using namespace std;
const int N = 1e6 + 20, INF = 2e9 + 7;
pii a[N];
sigma main(){
nemeshay
map <int, int> fir, sec;
int n, ans = 0;
cin >> n;
for (int i = 0; i < n; i++){
cin >> a[i].fr >> a[i].sc;
fir[a[i].fr]++;
sec[a[i].sc]++;
}
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
if (a[i] == a[j]) continue;
if (a[i].fr == a[j].fr) ans += sec[a[i].sc] - 1;
else if (a[i].sc == a[j].sc) ans += fir[a[i].fr] - 1;
}
}
cout << ans / 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |