# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
501740 |
2022-01-04T12:25:24 Z |
stefantaga |
Pairs (IOI07_pairs) |
C++14 |
|
459 ms |
485712 KB |
#include <bits/stdc++.h>
using namespace std;
int sum[75000005],v[75000005];
long long x,i,d,m,ceau,tip,n,stanga;
int main()
{
#ifdef HOME
ifstream cin("date.in");
ofstream cout("date.out");
#endif // HOME
cin>>tip;
if (tip==1)
{
cin>>n>>d>>m;
for (i=1;i<=n;i++)
{
cin>>x;
v[x]++;
}
for (i=1;i<=m;i++)
{
sum[i]=sum[i-1]+v[i];
if (i-d-1<0)
{
stanga=0;
}
else
{
stanga=sum[i-d-1];
}
ceau=ceau+1LL*(sum[i-1]-stanga)*v[i]+(1LL*v[i]*(v[i]-1))/2;
}
cout<<ceau;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
371 ms |
298220 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
480 KB |
Output is correct |
2 |
Correct |
19 ms |
588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
459 ms |
485712 KB |
Output is correct |
2 |
Correct |
438 ms |
485692 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
445 ms |
485600 KB |
Output is correct |
2 |
Correct |
399 ms |
287640 KB |
Output is correct |
3 |
Correct |
418 ms |
279664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |