QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#586700#9381. 502 Bad Gatewayucup-team1769WA 169ms3788kbC++20935b2024-09-24 15:06:352024-09-24 15:06:35

Judging History

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

  • [2024-09-24 15:06:35]
  • 评测
  • 测评结果:WA
  • 用时:169ms
  • 内存:3788kb
  • [2024-09-24 15:06:35]
  • 提交

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++) {
        i64 t;
        std::cin >> t;

        i64 a = floor(std::sqrt(2 * t));
        i64 b = ceil(std::sqrt(2 * t));

        i64 a_ = (a - 1) * a + 2 * t;
        i64 b_ = (b - 1) * b + 2 * t;
        i64 _a = 2 * a;
        i64 _b = 2 * b;
        i64 ga = std::gcd(a_, _a);
        i64 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();
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3700kb

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 169ms
memory: 3788kb

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
2000006281 44722
1 1
1 1
2000006281 44722
1 1
2000006281 44722
1 1
1 1
1 1
2000006281 44722
1 1
1 1
2000006281 44722
1 1
2000006281 44722
2000006281 44722
1 1
2000006281 44722
1 1
1 1
2000006281 44722
1 1
2000006281 44722
2000006281 44722
1 1
2000006281 44722
2000006281 44722
2000006281 44722
20...

result:

wrong answer 2nd lines differ - expected: '1999961560 44721', found: '2000006281 44722'