QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#581932 | #9381. 502 Bad Gateway | MuQYY | WA | 547ms | 3604kb | C++17 | 644b | 2024-09-22 14:39:30 | 2024-09-22 14:39:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve()
{
int n;
cin >> n;
int c1 = sqrt(2 * n); // lower
int c2 = c1 + 1; // higher
long long a1 = c1 * c1 - c1 + 2 * n;
long long a2 = c2 * c2 - c2 + 2 * n;
long long b1 = 2 * c1;
long long b2 = 2 * c2;
if(a1 * b2 < a2 * b1)
{
cout << a1 / __gcd(a1, b1) << ' ' << b1 / __gcd(a1, b1) << endl;
}
else{
cout << a2 / __gcd(a2, b2) << ' ' << b2 / __gcd(a2, b2) << endl;
}
}
int main()
{
int t;
cin >> t;
while(t--)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3444kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 547ms
memory: 3604kb
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 147522088 -44721 1 1 1 1 147522088 -44721 1 1 147522088 -44721 1 1 1 1 1 1 147522088 -44721 1 1 1 1 147522088 -44721 1 1 147522088 -44721 147522088 -44721 1 1 147522088 -44721 1 1 1 1 147522088 -44721 1 1 147522088 -44721 147522088 -44721 1 1 147522088 -44721 147522088 -44721 147522088 -44721 14...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '147522088 -44721'