# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
157596 |
2019-10-12T14:19:33 Z |
stefdasca |
Pairs (IOI07_pairs) |
C++14 |
|
31 ms |
760 KB |
#include<bits/stdc++.h>
using namespace std;
int tip, n, d, m;
int v[100002];
long long ans;
void solve1()
{
for(int i = 1; i <= n; ++i)
cin >> v[i];
sort(v+1, v+n+1);
for(int i = 1; i <= n; ++i)
{
int sm = i;
int st = 1;
int dr = i-1;
while(st <= dr)
{
int mid = (st + dr) / 2;
if(v[i] - v[mid] <= d)
sm = mid, dr = mid - 1;
else
st = mid + 1;
}
ans += (i - sm);
}
cout << ans << '\n';
}
void solve2()
{
}
void solve3()
{
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> tip >> n >> d >> m;
if(tip == 1)
solve1();
if(tip == 2)
solve2();
if(tip == 3)
solve3();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 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 |
21 ms |
760 KB |
Output is correct |
2 |
Correct |
20 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
760 KB |
Output is correct |
2 |
Correct |
27 ms |
732 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
760 KB |
Output is correct |
2 |
Correct |
31 ms |
688 KB |
Output is correct |
3 |
Correct |
30 ms |
760 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 |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |