Search for a command to run...
Progressive hints first, then the full explanation and implementation when you're ready to cash out.
Review status
AI-generated and still unreviewed. Double-check the details before internalizing them.
Hints
Open only as much as you need to keep the solve alive.
You only have three numbers, so don't overthink it. Find the smallest and largest score first.
The contest is rejected when the spread between scores is too large: compute .
"Differ by at least 10" means >= 10, not > 10. Exactly 10 is already bad enough to say check again.
If the scores pass the consistency check, the answer is the median: the middle value after sorting the three numbers.
Sort the three scores. If a[2] - a[0] >= 10, print check again; otherwise print final a[1].
Core Idea
We are given exactly three scores: Gemini's, ChatGPT's, and Claude's. Each score is already guaranteed to be between 80 and 100, so there is no validation nonsense to handle. The whole problem is just:
Let the three scores be sorted as:
Then:
The judging is considered inconsistent if:
That >= matters. If the scores are 80 90 100, the max-min difference is 20, obviously rejected. But if the scores are 80 90 89, the difference is exactly 10, and that is also rejected. The statement says at least 10, so don't sneak in a strict > and donate a wrong answer to the void.
Why Sorting Works
With three numbers, sorting is the cleanest move. After sorting, the median is literally sitting in the middle at index 1. No special cases for equal values are needed:
98 99 98 sorts to 98 98 99, median is 98.88 94 95 is already close enough, median is 94.95 86 85 sorts to 85 86 95, spread is 10, so print check again.Duplicates are totally fine. The median is still just the middle value after sorting.
Algorithm
a[2] - a[0] >= 10, print check again.final followed by a[1].Complexity
Sorting three numbers is constant time. So the complexity is:
Memory usage is also:
That's it. Tiny problem, tiny solution. No need to bring a chainsaw to cut a sandwich.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void setIO() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
setIO();
vector<int> a(3);
cin >> a[0] >> a[1] >> a[2];
sort(a.begin(), a.end());
if (a[2] - a[0] >= 10) {
cout << "check again\n";
} else {
cout << "final " << a[1] << '\n';
}
return 0;
}#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void setIO() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
setIO();
vector<int> a(3);
cin >> a[0] >> a[1] >> a[2];
sort(a.begin(), a.end());
if (a[2] - a[0] >= 10) {
cout << "check again\n";
} else {
cout << "final " << a[1] << '\n';
}
return 0;
}