QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#581994 | #9381. 502 Bad Gateway | SMTTY | WA | 220ms | 3800kb | C++14 | 645b | 2024-09-22 14:54:21 | 2024-09-22 14:54:22 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
ll calc(ll c, ll t){
return c * c * t + 2 * c * c + 2 * t * t - 3 * c * t;
}
void solve(){
ll t, x, y, c;
scanf("%lld", &t);
x = sqrt(2 * t), y = x + 1;
// x = sqrt(t * t * 2 / (2 + t)), y = x + 1;
if (calc(x, t) * y < calc(y, t) * x) c = x;
else c = y;
c = t;
ll ans1 = calc(c, t), ans2 = 2 * t * c;
ll gcd = __gcd(ans1, ans2);
printf("%lld %lld\n", ans1 / gcd, ans2 / gcd);
}
int main(){
int _;
scanf("%d", &_);
while (_ -- ) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3752kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 220ms
memory: 3800kb
input:
1000000 1 1000000000 1 1 1000000000 1 1000000000 1 1 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1 1 1000000000 1 1000000000 1000000000 1000000000 1000000000 1 1 1 10000000...
output:
1 1 -22624583539751 7629394531250 1 1 1 1 -22624583539751 7629394531250 1 1 -22624583539751 7629394531250 1 1 1 1 1 1 -22624583539751 7629394531250 1 1 1 1 -22624583539751 7629394531250 1 1 -22624583539751 7629394531250 -22624583539751 7629394531250 1 1 -22624583539751 7629394531250 1 1 1 1 -2262458...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '-22624583539751 7629394531250'