# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
786458 |
2023-07-18T08:04:26 Z |
danikoynov |
Pairs (IOI07_pairs) |
C++14 |
|
47 ms |
2596 KB |
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
const int maxn = 1e5 + 10;
struct point
{
int x, y, z;
point(int _x = 0, int _y = 0, int _z = 0)
{
x = _x;
y = _y;
z = _z;
}
}p[maxn];
bool cmp(point p1, point p2)
{
return p1.x < p2.x;
}
int b, n, d, m;
void solve()
{
cin >> b >> n >> d >> m;
for (int i = 1; i <= n; i ++)
{
cin >> p[i].x;
if (b >= 2)
cin >> p[i].y;
if (b == 3)
cin >> p[i].z;
}
if (b == 1)
{
sort(p + 1, p + n + 1, cmp);
int pt = 1;
ll ans = 0;
for (int i = 1; i <= n; i ++)
{
while(p[i].x - p[pt].x > d)
pt ++;
///cout << i << " : " << p[i].x << " " << pt << endl;
ans += (ll)(i - pt);
}
cout << ans << endl;
}
}
int main()
{
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1364 KB |
Output is correct |
2 |
Correct |
2 ms |
1364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
1708 KB |
Output is correct |
2 |
Correct |
23 ms |
1728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
1704 KB |
Output is correct |
2 |
Correct |
37 ms |
1808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
1708 KB |
Output is correct |
2 |
Correct |
38 ms |
1712 KB |
Output is correct |
3 |
Correct |
36 ms |
1620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
1968 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
2220 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
2596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
38 ms |
1960 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
38 ms |
2252 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
2256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |