QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#71355#5253. DenormalizationSorting#WA 0ms3680kbC++1.7kb2023-01-09 20:27:482023-01-09 20:27:50

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-09 20:27:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3680kb
  • [2023-01-09 20:27:48]
  • 提交

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