QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499356 | #6727. K-hour Clock | Railgun2334 | WA | 0ms | 3512kb | C++20 | 844b | 2024-07-31 13:15:44 | 2024-07-31 13:15:45 |
Judging History
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)