# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
619631 |
2022-08-02T13:53:09 Z |
1ne |
Pairs (IOI07_pairs) |
C++14 |
|
446 ms |
293740 KB |
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int b,n,d,m;cin>>b>>n>>d>>m;
if (b == 1){
vector<int>arr(m + 1,0);
for (int i = 0;i<n;++i){
int a;cin>>a;
arr[a]++;
}
for (int i = 1;i<=m;++i){
arr[i]+=arr[i - 1];
}
long long ans = arr[d] * (arr[d] - 1)/2;
for (int i = d + 1;i<=m;++i){
//cout<<i<<" "<<(arr[i] - arr[i - 1])<<" "<<arr[i - 1] - arr[i - d - 1]<<'\n';
long long pos = (arr[i] - arr[i - 1]) * (arr[i - 1] - arr[i - d - 1]);
ans+=pos;
ans+=(arr[i] - arr[i - 1]) * (arr[i] - arr[i - 1] - 1)/2;
}
cout<<ans<<'\n';
}
else if (b == 2){
}
else{
}
return 0;
}
# |
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 |
429 ms |
293740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
596 KB |
Output is correct |
2 |
Incorrect |
6 ms |
588 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
411 ms |
275112 KB |
Output is correct |
2 |
Incorrect |
303 ms |
275192 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
414 ms |
275044 KB |
Output is correct |
2 |
Correct |
377 ms |
275100 KB |
Output is correct |
3 |
Correct |
446 ms |
275092 KB |
Output is correct |
# |
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 |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |