Task: | Prinova |
Sender: | untokarila |
Submission time: | 2019-07-29 14:39:26 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | details |
#2 | WRONG ANSWER | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.01 s | details |
#6 | ACCEPTED | 0.01 s | details |
#7 | WRONG ANSWER | 0.01 s | details |
#8 | ACCEPTED | 0.01 s | details |
#9 | WRONG ANSWER | 0.01 s | details |
#10 | ACCEPTED | 0.01 s | details |
Code
#include <iostream> #include <algorithm> #define F first #define S second using namespace std; int d[100]; pair<int, pair<int, int> > p; int main(){ int n, a, b; cin >> n; for(int i=0; i<n; i++) cin >> d[i]; cin >> a >> b; if(!(a&1)) a++; if(!(b&1)) b--; sort(d, d+n); for(int i=1; i<n; i++){ if(d[i-1]>=a && d[i-1]+(d[i]-d[i-1])/2 <= b && d[i]-d[i-1] > p.F){ p = {d[i]-d[i-1], {d[i-1], d[i]}}; } } if(a<d[0] && d[0]-a > p.F){ cout << a; return 0; } if(b>d[n-1] && b-d[n-1] > p.F){ cout << b; return 0; } if(!((p.S.F+p.F/2)&1)) p.S.F++; cout << p.S.F+p.F/2; return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
5
38 50 60 30 48 23 69 |
correct output |
---|
69 |
user output |
---|
43 |
Test 2
Verdict: WRONG ANSWER
input |
---|
5
12 10 50 24 40 9 16 |
correct output |
---|
15 |
user output |
---|
11 |
Test 3
Verdict: ACCEPTED
input |
---|
10
46 64 26 82 18 106 60 138 194 ... |
correct output |
---|
165 |
user output |
---|
167 |
Test 4
Verdict: ACCEPTED
input |
---|
20
114 48 86 180 176 66 126 194 5... |
correct output |
---|
99 |
user output |
---|
101 |
Test 5
Verdict: ACCEPTED
input |
---|
30
46 112 106 70 186 80 62 2 162 ... |
correct output |
---|
25 |
user output |
---|
123 |
Test 6
Verdict: ACCEPTED
input |
---|
50
7362 772 4354 5462 4924 5224 2... |
correct output |
---|
3953 |
user output |
---|
3953 |
Test 7
Verdict: WRONG ANSWER
input |
---|
67
7518 4798 5528 3806 7798 3396 ... |
correct output |
---|
6467 |
user output |
---|
6971 |
Test 8
Verdict: ACCEPTED
input |
---|
79
263044060 323471968 60083128 7... |
correct output |
---|
173959055 |
user output |
---|
173959057 |
Test 9
Verdict: WRONG ANSWER
input |
---|
99
412812216 39588698 618476302 2... |
correct output |
---|
2577535 |
user output |
---|
306543053 |
Test 10
Verdict: ACCEPTED
input |
---|
100
635179944 592614358 645156538 ... |
correct output |
---|
493216533 |
user output |
---|
493216533 |