QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#145860 | #1778. Grazed Grains | acm202226010311 | AC ✓ | 2ms | 5276kb | C++14 | 866b | 2023-08-22 14:45:01 | 2023-08-22 14:45:02 |
Judging History
answer
#include<iostream>
#include<cmath>
using namespace std;
struct po
{
int x;
int y;
int r;
};
int map[610][610];
int main()
{
int n;
cin>>n;
po pos[n];
int res=0;
for(int i=0;i<n;i++)cin>>pos[i].x>>pos[i].y>>pos[i].r;
for(int i=0;i<n;i++)
{
for(int nx=pos[i].x*20+200-pos[i].r*20;nx<=pos[i].x*20+200+pos[i].r*20;nx++)
for(int ny=pos[i].y*20+200-pos[i].r*20;ny<=pos[i].y*20+200+pos[i].r*20;ny++)
if((nx-200-pos[i].x*20)*(nx-200-pos[i].x*20)+(ny-200-pos[i].y*20)*(ny-200-pos[i].y*20)<=pos[i].r*pos[i].r*400)
map[nx][ny]++;
}
for(int i=0;i<n;i++)
{
for(int nx=pos[i].x*20+200-pos[i].r*20;nx<=pos[i].x*20+200+pos[i].r*20;nx++)
for(int ny=pos[i].y*20+200-pos[i].r*20;ny<=pos[i].y*20+200+pos[i].r*20;ny++)
if(map[nx][ny])
{
res++;
map[nx][ny]=0;
}
}
double ans=res*1.0/400;
cout<<ans;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4296kb
input:
1 10 9 4
output:
50.2025
result:
ok found '50.20250', expected '50.26548', error '0.00125'
Test #2:
score: 0
Accepted
time: 0ms
memory: 4880kb
input:
2 6 10 10 6 4 8
output:
369.848
result:
ok found '369.84800', expected '369.96071', error '0.00030'
Test #3:
score: 0
Accepted
time: 1ms
memory: 4876kb
input:
3 5 6 9 0 1 9 2 2 8
output:
378.608
result:
ok found '378.60800', expected '378.66090', error '0.00014'
Test #4:
score: 0
Accepted
time: 1ms
memory: 5060kb
input:
4 6 1 10 1 8 3 5 8 7 10 10 10
output:
509.81
result:
ok found '509.81000', expected '509.94354', error '0.00026'
Test #5:
score: 0
Accepted
time: 1ms
memory: 4820kb
input:
5 4 9 5 3 2 3 10 7 7 9 3 6 5 8 8
output:
284.088
result:
ok found '284.08800', expected '284.20315', error '0.00041'
Test #6:
score: 0
Accepted
time: 1ms
memory: 5112kb
input:
6 6 7 6 0 5 10 9 6 3 2 0 4 2 10 5 8 1 7
output:
402.783
result:
ok found '402.78300', expected '402.91911', error '0.00034'
Test #7:
score: 0
Accepted
time: 1ms
memory: 5060kb
input:
7 4 2 8 10 1 9 0 2 2 5 10 4 10 3 10 6 4 7 9 1 4
output:
397.452
result:
ok found '397.45200', expected '397.58209', error '0.00033'
Test #8:
score: 0
Accepted
time: 2ms
memory: 5008kb
input:
8 9 7 7 2 10 9 6 8 3 5 6 4 6 3 1 6 7 4 0 6 3 7 4 6
output:
343.738
result:
ok found '343.73800', expected '343.81511', error '0.00022'
Test #9:
score: 0
Accepted
time: 1ms
memory: 5208kb
input:
9 5 2 8 10 9 9 6 5 4 5 10 5 7 2 4 5 5 1 5 7 5 0 0 8 3 8 1
output:
458.445
result:
ok found '458.44500', expected '458.55258', error '0.00023'
Test #10:
score: 0
Accepted
time: 0ms
memory: 5200kb
input:
10 2 6 2 9 0 4 1 9 2 1 1 1 7 4 7 0 3 10 8 7 9 3 0 7 5 5 4 4 1 9
output:
480.125
result:
ok found '480.12500', expected '480.22128', error '0.00020'
Test #11:
score: 0
Accepted
time: 1ms
memory: 4912kb
input:
10 1 2 7 1 0 4 1 1 1 3 1 10 0 0 3 3 0 3 2 1 10 2 1 5 1 0 8 3 0 8
output:
334.028
result:
ok found '334.02800', expected '334.15093', error '0.00037'
Test #12:
score: 0
Accepted
time: 1ms
memory: 4864kb
input:
10 4 3 5 1 3 6 6 0 9 3 0 7 1 6 10 0 5 3 1 0 10 0 1 8 2 6 10 0 2 1
output:
496.067
result:
ok found '496.06700', expected '496.19675', error '0.00026'
Test #13:
score: 0
Accepted
time: 1ms
memory: 4348kb
input:
10 8 6 1 5 3 1 4 6 1 7 0 1 5 7 1 10 7 1 3 7 1 4 0 1 10 4 1 3 1 1
output:
29.7075
result:
ok found '29.70750', expected '29.70354', error '0.00013'
Test #14:
score: 0
Accepted
time: 0ms
memory: 4444kb
input:
10 10 3 1 8 4 1 3 6 1 3 2 1 6 8 1 9 3 1 8 7 1 9 0 1 1 1 2 3 10 2
output:
47.4925
result:
ok found '47.49250', expected '47.50458', error '0.00025'
Test #15:
score: 0
Accepted
time: 0ms
memory: 4112kb
input:
2 0 0 1 10 10 1
output:
6.285
result:
ok found '6.28500', expected '6.28319', error '0.00029'
Test #16:
score: 0
Accepted
time: 2ms
memory: 5232kb
input:
8 0 0 10 0 5 10 0 10 10 5 10 10 10 10 10 10 5 10 10 0 10 5 0 10
output:
809.692
result:
ok found '809.69200', expected '809.95264', error '0.00032'
Test #17:
score: 0
Accepted
time: 1ms
memory: 4392kb
input:
10 3 4 5 3 4 5 3 4 5 3 4 5 3 4 5 3 4 5 3 4 5 3 4 5 3 4 5 3 4 5
output:
78.5425
result:
ok found '78.54250', expected '78.53982', error '0.00003'
Test #18:
score: 0
Accepted
time: 1ms
memory: 4052kb
input:
10 0 0 1 0 0 1 0 0 1 0 0 1 0 10 1 0 10 1 10 0 1 10 0 1 10 10 1 10 10 1
output:
12.57
result:
ok found '12.57000', expected '12.56637', error '0.00029'
Test #19:
score: 0
Accepted
time: 2ms
memory: 5276kb
input:
10 0 0 10 10 0 10 0 10 10 10 10 10 0 3 10 0 7 10 3 0 10 7 0 10 10 5 10 5 10 10
output:
810.778
result:
ok found '810.77800', expected '811.06784', error '0.00036'
Test #20:
score: 0
Accepted
time: 1ms
memory: 4696kb
input:
4 0 0 4 0 10 4 10 0 4 10 10 4
output:
200.81
result:
ok found '200.81000', expected '201.06193', error '0.00125'
Test #21:
score: 0
Accepted
time: 1ms
memory: 4168kb
input:
10 0 0 1 0 2 1 0 4 1 0 6 1 0 8 1 0 10 1 10 0 1 10 2 1 10 4 1 10 6 1
output:
31.405
result:
ok found '31.40500', expected '31.41593', error '0.00035'