# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1093323 | DennisTran | 허수아비 (JOI14_scarecrows) | C++17 | 74 ms | 5468 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 FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FOD(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define __Dennis_Tran___ signed main()
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
using namespace std;
const int maxN = 2e5 + 5;
int n;
pair <int, int> a[maxN];
int dd[2002][2002];
__Dennis_Tran___{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n;
FOR(i, 1, n) cin >> a[i].first >> a[i].second;
sort(a + 1, a + n + 1);
vector <int> nen;
FOR(i, 1, n) nen.emplace_back(a[i].second);
sort(ALL(nen));
FOR(i, 1, n) a[i].second = lower_bound(ALL(nen), a[i].second) - nen.begin() + 1;
long long ans = 0;
FOR(i, 1, n) {
vector <int> val;
int j = i;
while (j <= n && a[j].first == a[i].first) val.emplace_back(a[j++].second);
i = j - 1;
sort(ALL(val));
REP(i, val.size()) FOR(j, i + 1, val.size() - 1)
ans += dd[val[i]][val[j]]++;
}
cout << ans;
cerr << "Time elapsed: " << TIME << " s.\n";
return (0 ^ 0);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |