QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#499356#6727. K-hour ClockRailgun2334WA 0ms3512kbC++20844b2024-07-31 13:15:442024-07-31 13:15:45

Judging History

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

  • [2024-07-31 13:15:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3512kb
  • [2024-07-31 13:15:44]
  • 提交

answer

#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cstdio>
#include <cmath>
#define int long long
using namespace std;
const int N = 2e5 + 10, M = 1e6 + 10, MOD = 998244353;
int a[N];
typedef pair<int, int> PII;
void solove() {
    int x, y, z;
    cin >> x >> y >> z;
    if (x + y < z) cout << "-1\n";
    else if (x < z)cout << "-1\n";
    else if (x + y == z) cout << x + y + 5 << '\n';
    else {
        int t = x + y - z;
        if ((x + y) % t == z) cout << t << '\n';
        else cout << "-1\n";
    }
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TT = 1;
    cin >> TT;
    while (TT--) {
        solove();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3512kb

input:

4
11 18 5
3 49 4
1 9 1
1 3 10

output:

24
-1
9
-1

result:

wrong answer Case #2: Participant says impossible but a solution actually exists (x = 3, y = 49, z = 4, k = -1)