QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#319055 | #4991. Disc District | tz3528 | AC ✓ | 43ms | 11748kb | C++14 | 377b | 2024-02-01 17:36:12 | 2024-02-01 17:36:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
long long a[1000010];
int main(){
long long r;
cin>>r;
for(long long i=1;i<=1000000;i++){
a[i]=i*i;
}
long long ans=1e18,x,y;
for(long long i=1;i*i<=r*r;i++){
long long sum=r*r-i*i;
int k=lower_bound(a+1,a+1000001,sum)-a;
if(ans>i*i+a[k]){
x=i,y=k;
}
}
printf("%lld %lld\n",x,y);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 11680kb
input:
1
output:
1 1
result:
ok
Test #2:
score: 0
Accepted
time: 2ms
memory: 11688kb
input:
8
output:
8 1
result:
ok
Test #3:
score: 0
Accepted
time: 2ms
memory: 11640kb
input:
90210
output:
90210 1
result:
ok
Test #4:
score: 0
Accepted
time: 2ms
memory: 11556kb
input:
11211
output:
11211 1
result:
ok
Test #5:
score: 0
Accepted
time: 23ms
memory: 11684kb
input:
524288
output:
524288 1
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 11568kb
input:
99
output:
99 1
result:
ok
Test #7:
score: 0
Accepted
time: 43ms
memory: 11584kb
input:
1000000
output:
1000000 1
result:
ok
Test #8:
score: 0
Accepted
time: 42ms
memory: 11552kb
input:
999999
output:
999999 1
result:
ok
Test #9:
score: 0
Accepted
time: 9ms
memory: 11584kb
input:
192837
output:
192837 1
result:
ok
Test #10:
score: 0
Accepted
time: 40ms
memory: 11748kb
input:
999997
output:
999997 1
result:
ok
Test #11:
score: 0
Accepted
time: 16ms
memory: 11628kb
input:
424242
output:
424242 1
result:
ok
Test #12:
score: 0
Accepted
time: 9ms
memory: 11692kb
input:
171407
output:
171407 1
result:
ok
Test #13:
score: 0
Accepted
time: 27ms
memory: 11588kb
input:
605579
output:
605579 1
result:
ok
Test #14:
score: 0
Accepted
time: 42ms
memory: 11692kb
input:
971813
output:
971813 1
result:
ok
Test #15:
score: 0
Accepted
time: 7ms
memory: 11684kb
input:
131198
output:
131198 1
result:
ok
Test #16:
score: 0
Accepted
time: 0ms
memory: 11640kb
input:
80069
output:
80069 1
result:
ok
Test #17:
score: 0
Accepted
time: 32ms
memory: 11636kb
input:
838980
output:
838980 1
result:
ok
Test #18:
score: 0
Accepted
time: 14ms
memory: 11624kb
input:
394053
output:
394053 1
result:
ok
Test #19:
score: 0
Accepted
time: 39ms
memory: 11624kb
input:
977835
output:
977835 1
result:
ok
Test #20:
score: 0
Accepted
time: 27ms
memory: 11684kb
input:
616143
output:
616143 1
result:
ok
Test #21:
score: 0
Accepted
time: 21ms
memory: 11624kb
input:
469961
output:
469961 1
result:
ok
Test #22:
score: 0
Accepted
time: 10ms
memory: 11652kb
input:
216504
output:
216504 1
result:
ok
Test #23:
score: 0
Accepted
time: 5ms
memory: 11620kb
input:
81537
output:
81537 1
result:
ok