| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 856491 | aykhn | 별들과 삼각형 (IZhO11_triangle) | C++14 | 681 ms | 37672 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
// author : aykhn
using namespace std;
typedef long long ll;
#define pb push_back
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcount
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define int ll
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
map<pii, int> mp;
signed main()
{
int n;
cin >> n;
vector<int> x, y;
vector<pii> c;
for (int i = 0; i < n; i++)
{
int a, b;
cin >> a >> b;
c.pb(mpr(a, b));
x.pb(a);
y.pb(b);
mp[mpr(a, b)]++;
}
sort(all(x));
sort(all(y));
int res = 0;
for (int i = 0; i < n; i++)
{
int c1 = upper_bound(all(x), c[i].fi) - lower_bound(all(x), c[i].fi);
int c2 = upper_bound(all(y), c[i].se) - lower_bound(all(y), c[i].se);
c1 -= mp[c[i]];
c2 -= mp[c[i]];
res += c1 * c2;
}
cout << res << '\n';
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
