# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
120045 | 2019-06-23T06:16:12 Z | Boxworld | Pairs (IOI07_pairs) | C++14 | 4000 ms | 2140 KB |
#include <bits/stdc++.h> using namespace std; const int N=100010; struct point{int x,y,z;}a[N]; long long ans=0; int B,n,d,m; bool cmp(point a,point b){return a.x<b.x;} void solve1(){ for (int i=0;i<n;i++)scanf("%d",&a[i].x); sort(a,a+n,cmp); int tmp=0; for (int i=1;i<n;i++){ while (a[i].x-a[tmp].x>d)tmp++; ans+=(i-tmp); } } double dist2(int x,int y,int X,int Y){return abs(X-x)+abs(Y-y);} void solve2(){ for (int i=0;i<n;i++){ scanf("%d%d",&a[i].x,&a[i].y); for (int j=0;j<i;j++) if (dist2(a[i].x,a[i].y,a[j].x,a[j].y)<=d)ans++; } } double dist3(int x,int y,int z,int X,int Y,int Z){return abs(X-x)+abs(Y-y)+abs(Z-z);} void solve3(){ for (int i=0;i<n;i++){ scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].z); for (int j=0;j<i;j++) if (dist3(a[i].x,a[i].y,a[i].z,a[j].x,a[j].y,a[j].z)<=d)ans++; } } int main(){ scanf("%d%d%d%d",&B,&n,&d,&m); if (B==1)solve1(); if (B==2)solve2(); if (B==3)solve3(); printf("%lld\n",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 1664 KB | Output is correct |
2 | Correct | 20 ms | 1664 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 1664 KB | Output is correct |
2 | Correct | 28 ms | 1656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 1656 KB | Output is correct |
2 | Correct | 26 ms | 1656 KB | Output is correct |
3 | Correct | 25 ms | 1656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4085 ms | 1684 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4011 ms | 1812 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4069 ms | 2140 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4008 ms | 1508 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4026 ms | 1808 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4029 ms | 1572 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |