# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
697335 |
2023-02-09T09:53:10 Z |
starplat |
Pairs (IOI07_pairs) |
C++14 |
|
1089 ms |
7628 KB |
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
using namespace std;
int b,n,d,m,ans;
void d1(){
vector<int> c;
for (int i=0;i<n;i++){
c.push_back(0); cin>>c[i];
}
sort(c.begin(),c.end());
int pt=0;
for (int i=0;i<n;i++){
while (pt+1<n && c[pt+1]<=c[i]+d) ++pt;
ans+=pt-i;
}
}
void d2(){
vector<pair<int,int>> c;
}
int frq[85][85][85];
void d3(){
vector<pair<int,pair<int,int>>> q;
for (int i=0;i<n;i++){
q.push_back(mp(0,mp(0,0)));
cin>>q[i].first>>q[i].second.first>>q[i].second.second;
frq[q[i].second.first][q[i].second.second][q[i].first]++;
}
for (int i=1;i<=m;i++){
for (int j=1;j<=m;j++){
for (int k=1;k<=m;k++) {
frq[i][j][k]+=frq[i][j][k-1];
}
}
}
for (auto k:q){
for (int i=1;i<=m;i++){
for (int j=1;j<=m;j++){
int dist=d-abs(i-k.second.first)-abs(j-k.second.second);
if (dist<0) continue;
ans+=frq[i][j][min(m,k.first+dist)]-frq[i][j][max(0LL,k.first-dist)];
}
}
}
}
signed main(){
cin>>b>>n>>d>>m;
if (b==1) d1();
else if (b==2) d2();
else d3();
cout<<ans<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
304 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
1580 KB |
Output is correct |
2 |
Correct |
25 ms |
1848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
1600 KB |
Output is correct |
2 |
Correct |
42 ms |
1604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
1612 KB |
Output is correct |
2 |
Correct |
44 ms |
1808 KB |
Output is correct |
3 |
Correct |
41 ms |
1632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
316 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
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 |
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 |
13 ms |
4308 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
59 ms |
3700 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
533 ms |
6304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1089 ms |
7628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |