QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#586698 | #9381. 502 Bad Gateway | ucup-team1769 | WA | 171ms | 3592kb | C++20 | 935b | 2024-09-24 15:06:06 | 2024-09-24 15:06:06 |
Judging History
answer
#include <bits/stdc++.h>
using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;
void solve() {
int n;
std::cin >> n;
for (int i = 0; i < n; i++) {
int t;
std::cin >> t;
int a = floor(std::sqrt(2 * t));
int b = ceil(std::sqrt(2 * t));
int a_ = (a - 1) * a + 2 * t;
int b_ = (b - 1) * b + 2 * t;
int _a = 2 * a;
int _b = 2 * b;
int ga = std::gcd(a_, _a);
int gb = std::gcd(b_, _b);
a_ /= ga, _a /= ga;
b_ /= gb, _b /= gb;
if (a_ * _b > b_ * _a) {
std::cout << a_ << " " << _a << "\n";
} else {
std::cout << b_ << " " << _b << "\n";
}
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
//std::cin >> t;
t = 1;
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 171ms
memory: 3588kb
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 -147477367 44722 1 1 1 1 -147477367 44722 1 1 -147477367 44722 1 1 1 1 1 1 -147477367 44722 1 1 1 1 -147477367 44722 1 1 -147477367 44722 -147477367 44722 1 1 -147477367 44722 1 1 1 1 -147477367 44722 1 1 -147477367 44722 -147477367 44722 1 1 -147477367 44722 -147477367 44722 -147477367 44722 -1...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '-147477367 44722'