# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
785920 | 2023-07-17T19:08:09 Z | canadavid1 | Pairs (IOI07_pairs) | C++14 | 44 ms | 1564 KB |
#include <bits/stdc++.h> using namespace std; #define all(x) begin(x),end(x) using i64 = int64_t; // idea: k-d tree namespace d1 { void d1() { int N,D,M; cin >> N >> D >> M; vector<int> p(N); for(auto && i : p) cin >> i; sort(all(p)); i64 c=0; for(int i = 0; i < p.size();i++) { // binary search for furthest after it int thrs = p[i]+D; int l = i; int r = p.size(); while(r-l > 1) { int m = (r+l)/2; if(p[m]>thrs) r = m; else l = m; } c += (l-i); } cout << c << "\n"; } } // d1 void d2() { } void d3() { } int main() { int B; cin >> B; switch(B) { case 1: d1::d1();break; case 2: d2();break; case 3: d3();break; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 1072 KB | Output is correct |
2 | Correct | 25 ms | 1084 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 44 ms | 1544 KB | Output is correct |
2 | Correct | 39 ms | 1484 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 1456 KB | Output is correct |
2 | Correct | 38 ms | 1448 KB | Output is correct |
3 | Correct | 39 ms | 1564 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 312 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |