# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
197628 | 2020-01-22T04:37:45 Z | arnold518 | Pairs (IOI07_pairs) | C++14 | 43 ms | 2552 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1e5; struct Point { int x, y, z; Point() {} Point(int x) : x(x) {} Point(int x, int y) : x(x), y(y) {} Point(int x, int y, int z) : x(x), y(y), z(z) {} }; int B, N, D, M; Point A[MAXN+10]; ll ans; int main() { int i, j; scanf("%d%d%d%d", &B, &N, &D, &M); for(i=1; i<=N; i++) { if(B==1) scanf("%d", &A[i].x); if(B==2) scanf("%d%d", &A[i].x, &A[i].y); if(B==3) scanf("%d%d%d", &A[i].x, &A[i].y, &A[i].z); } if(B==1) { sort(A+1, A+N+1, [&](const Point &p, const Point &q) { return p.x<q.x; }); for(i=1; i<=N; i++) ans+=upper_bound(A+1, A+N+1, Point(A[i].x+D), [&](const Point &p, const Point &q) { return p.x<q.x; })-lower_bound(A+1, A+N+1, Point(A[i].x-D), [&](const Point &p, const Point &q) { return p.x<q.x; }); ans-=N; ans/=2; printf("%lld", ans); return 0; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 2040 KB | Output is correct |
2 | Correct | 27 ms | 1912 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 2300 KB | Output is correct |
2 | Correct | 33 ms | 2300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 2424 KB | Output is correct |
2 | Correct | 37 ms | 2400 KB | Output is correct |
3 | Correct | 34 ms | 2296 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 2040 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 2268 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 28 ms | 2552 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 28 ms | 2064 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 2268 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 30 ms | 2256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |