# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
581371 | 2022-06-22T14:34:54 Z | Do_you_copy | Pairs (IOI07_pairs) | C++14 | 26 ms | 2628 KB |
#include <bits/stdc++.h> #define taskname "test" #define fi first #define se second #define pb push_back #define faster ios_base::sync_with_stdio(0); cin.tie(0); using namespace std; using ll = long long; using pii = pair <int, int>; ll min(const ll &a, const ll &b){ return (a < b) ? a : b; } ll max(const ll &a, const ll &b){ return (a > b) ? a : b; } const ll Mod = 1000000007; const int maxN = 1e5 + 1; int n, d, m; struct TPoint{ int x, y = 0, z = 0; bool operator < (const TPoint &other){ if (x == other.x){ if (y == other.y) return z < other.z; return y < other.y; } return x < other.x; } }; TPoint a[maxN]; void Init(){ int type; cin >> type >> n >> d >> m; if (type == 1){ for (int i = 1; i <= n; ++i) cin >> a[i].x; sort(a + 1, a + n + 1); ll ans = 0; for (int i = 1; i <= n; ++i){ TPoint tem = {a[i].x - d, 0, 0}; int k = lower_bound(a + 1, a + n + 1, tem) - a; ans += i - k; } cout << ans; } if (type == 2){ for (int i = 1; i <= n; ++i) cin >> a[i].x >> a[i].y; } if (type == 3){ for (int i = 1; i <= n; ++i) cin >> a[i].x >> a[i].y >> a[i].z; } } int main(){ if (fopen(taskname".txt", "r")){ freopen(taskname".txt", "r", stdin); } faster //freopen(taskname.inp, "r", stdin) //freopen(taskname.out, "w", stdout) Init(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1364 KB | Output is correct |
2 | Correct | 1 ms | 1492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 1764 KB | Output is correct |
2 | Correct | 20 ms | 1876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 2260 KB | Output is correct |
2 | Correct | 21 ms | 2260 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 2248 KB | Output is correct |
2 | Correct | 24 ms | 2252 KB | Output is correct |
3 | Correct | 22 ms | 2376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1492 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 1992 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 2248 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 2628 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 1492 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 2004 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 2252 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 2268 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |