QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#580831 | #9381. 502 Bad Gateway | obliviatecqupt | WA | 161ms | 3636kb | C++20 | 684b | 2024-09-22 00:15:00 | 2024-09-22 00:15:01 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ull unsigned long long
#define ll long long
void solve(){
int t;
cin >> t;
int g = sqrt(2*t);
int a = 1e9, b = 1;
for(int w = max(1ll, g - 10); w <= min(t, g + 10); w++){
int ta = w*w - w + 2*t;
int tb = 2*w;
if(a*tb > tb*b) a = ta, b = tb;
}
int c = __gcd(a, b);
cout << a / c << ' ' << b / c << '\n';
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int _;
cin >> _;
while(_--){
solve();
// if(solve()) printf("YES\n");
// else printf("NO\n");
}
// solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3548kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 161ms
memory: 3636kb
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 2000408815 44731 1 1 1 1 2000408815 44731 1 1 2000408815 44731 1 1 1 1 1 1 2000408815 44731 1 1 1 1 2000408815 44731 1 1 2000408815 44731 2000408815 44731 1 1 2000408815 44731 1 1 1 1 2000408815 44731 1 1 2000408815 44731 2000408815 44731 1 1 2000408815 44731 2000408815 44731 2000408815 44731 20...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '2000408815 44731'