# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
371013 |
2021-02-25T14:51:49 Z |
cheissmart |
Pairs (IOI07_pairs) |
C++14 |
|
26 ms |
1664 KB |
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;
const int INF = 1e9 + 7;
int n, d, m;
void solve1() {
vi a(n);
for(int i = 0; i < n; i++) {
cin >> a[i];
}
sort(ALL(a));
ll ans = 0;
for(int i = 0, j = 0; i < n; i++) {
while(a[i] - a[j] > d) j++;
assert(a[i] - a[j] <= d);
ans += i - j;
}
cout << ans << '\n';
}
void solve2() {
}
int bit[76][76][76];
void add(int x, int y, int z, int val) {
for(int i = x; i < 76; i += i & -i)
for(int j = y; j < 76; j += j & -j)
for(int k = z; k < 76; k += k & -k)
bit[i][j][k] += val;
}
int qry(int x, int y, int z) {
int res = 0;
for(int i = x; i; i -= i & -i)
for(int j = y; j; j -= j & -j)
for(int k = z; k; k -= k & -k)
res += bit[i][j][k];
return res;
}
void solve3() {
for(int i = 0; i < n; i++) {
int x, y, z;
cin >> x >> y >> z;
}
}
signed main()
{
IO_OP;
int b;
cin >> b >> n >> d >> m;
if(b == 1) solve1();
else if(b == 2) solve2();
else solve3();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
1132 KB |
Output is correct |
2 |
Correct |
14 ms |
1132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1516 KB |
Output is correct |
2 |
Correct |
20 ms |
1644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
1660 KB |
Output is correct |
2 |
Correct |
24 ms |
1644 KB |
Output is correct |
3 |
Correct |
19 ms |
1664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
1004 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
1388 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
1132 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |