# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
867673 | sleepntsheep | 별들과 삼각형 (IZhO11_triangle) | C++17 | 155 ms | 5132 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,tune=native")
using namespace std;
#define ALL(x) x.begin(), x.end()
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
using ll = long long;
#define N 300005
int n, C, c[N], b[N];
array<int, 2> a[N]; ll z;
int main()
{
ShinLena;
for (int i = (cin >> n, 0); i < n; ++i) cin >> a[i][0] >> a[i][1], c[C++] = a[i][1];
sort(c, c+C);
for (int i = 0; i < n; ++i) ++b[a[i][1] = lower_bound(c, c+C, a[i][1]) - c];
sort(a, a+n); n = unique(a, a+n) - a;
for (ll f, e = 0, d = 0, i = 0, l = -1; i < n; ++i)
{
f = a[i][0] == l;
l += (a[i][0] - l) * !f, d *= f, e *= f;
z += d + (b[a[i][1]] - 1ll) * e;
++e, d += b[a[i][1]] - 1;
}
cout << z;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |