QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#71355 | #5253. Denormalization | Sorting# | WA | 0ms | 3680kb | C++ | 1.7kb | 2023-01-09 20:27:48 | 2023-01-09 20:27:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair < int , int > pii ;
typedef vector<int> vi;
#define fi first
#define se second
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
const int MAXN = 1e4 + 7 ;
const long double eps = 1e-3 ;
int n ;
long double a[ MAXN ] ;
const int lim = 1e4 ;
void solve ( ) {
cin >> n ;
for ( int i = 1 ; i <= n ; ++ i ) {
cin >> a[ i ] ;
}
for ( int i = 1 ; i <= lim ; ++ i ) {
long double d = i / a[ 1 ] ;
bool bad = false ;
ll tot = i ;
long double sm = i * i ;
for ( int j = 2 ; j <= n ; ++ j ) {
long double aux = a[ j ] * d ;
ll hh = round ( aux ) ;
if ( aux - hh > eps || aux - hh < -eps ) {
bad = true ;
break ;
}
if ( hh < 1 || hh > lim ) {
bad = true ;
break ;
}
sm += hh * hh ;
tot = __gcd ( tot , hh ) ;
}
if ( tot != 1 ) { bad = true ; }
long double act = sqrt ( sm ) ;
if ( act - d > eps || act - d < -eps ) {
bad = true ;
}
if ( bad == false ) {
for ( int j = 1 ; j <= n ; ++ j ) {
long double aux = a[ j ] * d ;
cout << round ( aux ) << "\n" ;
}
return ;
}
}
}
int main ( ) {
ios_base :: sync_with_stdio ( false ) ;
cin.tie ( NULL ) ;
int t = 1 ; // cin >> t ;
while ( t -- ) { solve ( ) ; }
return 0 ;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3680kb
input:
2 0.909840249060 0.414958698174
output:
296 135
result:
wrong answer incorrect solution