QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#90177 | #5253. Denormalization | chiranko# | RE | 3ms | 3640kb | C++14 | 955b | 2023-03-22 14:11:17 | 2023-03-22 14:11:23 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(l,r) for(int i=l;i<=r;i++)
#define jrep(l,r) for(int j=l;j<=r;j++)
using namespace std;
typedef long double LD;
typedef long long ll;
const int N=1e4+10;
int n;
LD a[N];
int b[N],c[N];
LD p[N];
bool check(int x)
{
rep(1,n)c[i]=round((double)b[i]/x);
int d=c[1];
rep(1,n)d=__gcd(d,c[i]);
// if(x==1)cout<<d<<"\n";
rep(1,n)c[i]/=d;
rep(1,n)if(c[i]>10000)return false;
LD q=0;
rep(1,n)q+=(LD)c[i]*c[i];
q=sqrt(q);
rep(1,n)p[i]=c[i]/q;
// if(x==1)rep(1,n)cout<<p[i]<<'\n';
rep(1,n)if(fabsl(p[i]-a[i])>1e-6)return false;
return true;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
rep(1,n)cin>>a[i];
rep(1,n)b[i]=round(sqrtl(a[i]*a[i]*1e16));
// rep(1,n)cout<<b[i]<<"\n";
rep(1,10000)if(check(i))
{
jrep(1,n)cout<<c[j]<<"\n";
//jrep(1,n)cout<<p[j]<<"\n";
return 0;
}
assert(false);
return 0;
}
/*
2
0.707107
0.707107
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3640kb
input:
2 0.909840249060 0.414958698174
output:
9073 4138
result:
ok good solution
Test #2:
score: 0
Accepted
time: 2ms
memory: 3584kb
input:
3 0.005731604132 0.696198848562 0.717826101486
output:
22 2672 2755
result:
ok good solution
Test #3:
score: 0
Accepted
time: 3ms
memory: 3484kb
input:
10 0.338936215010 0.390914583549 0.048893426174 0.446152513833 0.137891103101 0.017985796057 0.459132554353 0.201452557127 0.362800863500 0.358493585479
output:
5823 6716 840 7665 2369 309 7888 3461 6233 6159
result:
ok good solution
Test #4:
score: -100
Dangerous Syscalls
input:
100 0.027828573352 0.034289446708 0.021442608673 0.002752893865 0.091163859407 0.180717182268 0.012097751269 0.101332712254 0.087249881055 0.112643922419 0.016667180541 0.108449036530 0.050488448020 0.104216696303 0.120734059490 0.090096410766 0.066537631979 0.046668105514 0.174836851156 0.084908984...