Task: | Moon landing |
Sender: | Nallue |
Submission time: | 2024-09-23 17:38:42 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | WRONG ANSWER | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.00 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
#15 | WRONG ANSWER | 0.00 s | details |
#16 | WRONG ANSWER | 0.00 s | details |
#17 | WRONG ANSWER | 0.00 s | details |
#18 | WRONG ANSWER | 0.00 s | details |
#19 | WRONG ANSWER | 0.00 s | details |
#20 | WRONG ANSWER | 0.00 s | details |
#21 | WRONG ANSWER | 0.00 s | details |
#22 | WRONG ANSWER | 0.00 s | details |
#23 | WRONG ANSWER | 0.00 s | details |
#24 | WRONG ANSWER | 0.00 s | details |
#25 | ACCEPTED | 0.00 s | details |
#26 | WRONG ANSWER | 0.00 s | details |
#27 | WRONG ANSWER | 0.00 s | details |
#28 | WRONG ANSWER | 0.00 s | details |
#29 | WRONG ANSWER | 0.00 s | details |
#30 | WRONG ANSWER | 0.00 s | details |
#31 | WRONG ANSWER | 0.00 s | details |
#32 | WRONG ANSWER | 0.00 s | details |
#33 | WRONG ANSWER | 0.00 s | details |
#34 | WRONG ANSWER | 0.00 s | details |
#35 | WRONG ANSWER | 0.00 s | details |
#36 | WRONG ANSWER | 0.00 s | details |
#37 | WRONG ANSWER | 0.00 s | details |
#38 | WRONG ANSWER | 0.00 s | details |
#39 | WRONG ANSWER | 0.00 s | details |
#40 | WRONG ANSWER | 0.00 s | details |
#41 | WRONG ANSWER | 0.00 s | details |
#42 | WRONG ANSWER | 0.00 s | details |
#43 | WRONG ANSWER | 0.00 s | details |
#44 | WRONG ANSWER | 0.00 s | details |
#45 | WRONG ANSWER | 0.00 s | details |
#46 | WRONG ANSWER | 0.00 s | details |
#47 | WRONG ANSWER | 0.00 s | details |
#48 | WRONG ANSWER | 0.00 s | details |
#49 | WRONG ANSWER | 0.00 s | details |
#50 | WRONG ANSWER | 0.00 s | details |
#51 | WRONG ANSWER | 0.00 s | details |
#52 | WRONG ANSWER | 0.00 s | details |
#53 | WRONG ANSWER | 0.01 s | details |
#54 | WRONG ANSWER | 0.01 s | details |
#55 | WRONG ANSWER | 0.01 s | details |
#56 | WRONG ANSWER | 0.06 s | details |
#57 | WRONG ANSWER | 0.05 s | details |
#58 | WRONG ANSWER | 0.05 s | details |
#59 | WRONG ANSWER | 0.06 s | details |
#60 | WRONG ANSWER | 0.05 s | details |
#61 | WRONG ANSWER | 0.05 s | details |
#62 | WRONG ANSWER | 0.05 s | details |
#63 | WRONG ANSWER | 0.05 s | details |
#64 | WRONG ANSWER | 0.04 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:103:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 103 | while(idx2<moon.size()){ | ~~~~^~~~~~~~~~~~
Code
#include <iostream> #include <vector> #include <climits> using namespace std; class SegmentTreeMin { vector<int> tree; int n; public: SegmentTreeMin(const vector<int>& array) { n = array.size(); tree.resize(2 * n); build(array); } void build(const vector<int>& array) { for (int i = 0; i < n; i++) tree[n + i] = array[i]; for (int i = n - 1; i > 0; --i) tree[i] = min(tree[2 * i], tree[2 * i + 1]); } int rangeMin(int l, int r) { int minVal = INT_MAX; l += n; r += n; while (l < r) { if (l & 1) minVal = min(minVal, tree[l++]); if (r & 1) minVal = min(minVal, tree[--r]); l >>= 1; r >>= 1; } return minVal; } void update(int idx, int value) { idx += n; tree[idx] = value; for (idx >>= 1; idx > 0; idx >>= 1) { tree[idx] = min(tree[2 * idx], tree[2 * idx + 1]); } } }; class SegmentTreeMax { vector<int> tree; int n; public: SegmentTreeMax(const vector<int>& array) { n = array.size(); tree.resize(2 * n); build(array); } void build(const vector<int>& array) { for (int i = 0; i < n; i++) tree[n + i] = array[i]; for (int i = n - 1; i > 0; --i) tree[i] = max(tree[2 * i], tree[2 * i + 1]); } int rangeMax(int l, int r) { int maxVal = INT_MIN; l += n; r += n; while (l < r) { if (l & 1) maxVal = max(maxVal, tree[l++]); if (r & 1) maxVal = max(maxVal, tree[--r]); l >>= 1; r >>= 1; } return maxVal; } void update(int idx, int value) { idx += n; tree[idx] = value; for (idx >>= 1; idx > 0; idx >>= 1) { tree[idx] = max(tree[2 * idx], tree[2 * idx + 1]); } } }; int main(){ int n,x; cin >> n >> x; vector<int> moon(n); for(int i=0; i<n; i++) cin >> moon[i]; SegmentTreeMax STMAX(moon); SegmentTreeMin STMIN(moon); int idx1,idx2; idx1 = 0; idx2 = 0; int dist=1; int pos=0; int max_dist=1; while(idx2<moon.size()){ int max=STMAX.rangeMax(idx1,idx2+1); int min=STMIN.rangeMin(idx1,idx2+1); if((dist>max_dist) and ((max-min)<=x)){ max_dist=dist; pos=idx1; idx2 += 1; dist += 1; } else if((max-min)>x){ idx1 = idx2; dist=1; } else{ idx2 += 1; dist += 1; } //cout << idx1 <<endl; } cout<<pos+1<<" "<<dist<<endl; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
1 1 6 |
correct output |
---|
1 1 |
user output |
---|
1 2 |
Test 2
Verdict: WRONG ANSWER
input |
---|
2 10 0 2 |
correct output |
---|
1 2 |
user output |
---|
1 3 |
Test 3
Verdict: WRONG ANSWER
input |
---|
2 4 7 7 |
correct output |
---|
1 2 |
user output |
---|
1 3 |
Test 4
Verdict: WRONG ANSWER
input |
---|
3 8 5 10 5 |
correct output |
---|
1 3 |
user output |
---|
1 4 |
Test 5
Verdict: WRONG ANSWER
input |
---|
3 10 3 6 7 |
correct output |
---|
1 3 |
user output |
---|
1 4 |
Test 6
Verdict: WRONG ANSWER
input |
---|
3 0 6 9 5 |
correct output |
---|
1 1 |
user output |
---|
1 2 |
Test 7
Verdict: ACCEPTED
input |
---|
4 3 8 5 1 10 |
correct output |
---|
1 2 |
user output |
---|
1 2 |
Test 8
Verdict: WRONG ANSWER
input |
---|
4 9 6 3 8 7 |
correct output |
---|
1 4 |
user output |
---|
1 5 |
Test 9
Verdict: WRONG ANSWER
input |
---|
4 10 1 9 6 8 |
correct output |
---|
1 4 |
user output |
---|
1 5 |
Test 10
Verdict: WRONG ANSWER
input |
---|
5 6 6 7 9 6 9 |
correct output |
---|
1 5 |
user output |
---|
1 6 |
Test 11
Verdict: ACCEPTED
input |
---|
5 4 10 7 10 0 1 |
correct output |
---|
1 3 |
user output |
---|
1 3 |
Test 12
Verdict: WRONG ANSWER
input |
---|
5 4 2 0 10 6 10 |
correct output |
---|
3 3 |
user output |
---|
3 4 |
Test 13
Verdict: WRONG ANSWER
input |
---|
5 6 0 7 9 3 1 |
correct output |
---|
2 3 |
user output |
---|
2 2 |
Test 14
Verdict: WRONG ANSWER
input |
---|
5 10 9 6 1 10 9 |
correct output |
---|
1 5 |
user output |
---|
1 6 |
Test 15
Verdict: WRONG ANSWER
input |
---|
5 2 0 9 9 2 4 |
correct output |
---|
2 2 |
user output |
---|
2 3 |
Test 16
Verdict: WRONG ANSWER
input |
---|
5 9 10 3 2 9 0 |
correct output |
---|
1 4 |
user output |
---|
1 2 |
Test 17
Verdict: WRONG ANSWER
input |
---|
5 0 2 8 3 4 10 |
correct output |
---|
1 1 |
user output |
---|
1 2 |
Test 18
Verdict: WRONG ANSWER
input |
---|
5 9 0 10 2 9 4 |
correct output |
---|
2 4 |
user output |
---|
2 5 |
Test 19
Verdict: WRONG ANSWER
input |
---|
5 0 4 5 5 5 0 |
correct output |
---|
2 3 |
user output |
---|
2 2 |
Test 20
Verdict: WRONG ANSWER
input |
---|
10 6 6 7 9 6 9 5 9 4 6 7 |
correct output |
---|
1 10 |
user output |
---|
1 11 |
Test 21
Verdict: WRONG ANSWER
input |
---|
10 4 10 7 10 0 1 3 10 1 2 1 |
correct output |
---|
1 3 |
user output |
---|
1 4 |
Test 22
Verdict: WRONG ANSWER
input |
---|
10 4 2 0 10 6 10 4 5 4 3 3 |
correct output |
---|
6 5 |
user output |
---|
6 6 |
Test 23
Verdict: WRONG ANSWER
input |
---|
10 6 0 7 9 3 1 5 6 9 4 9 |
correct output |
---|
6 5 |
user output |
---|
2 4 |
Test 24
Verdict: WRONG ANSWER
input |
---|
10 10 9 6 1 10 9 7 6 7 6 2 |
correct output |
---|
1 10 |
user output |
---|
1 11 |
Test 25
Verdict: ACCEPTED
input |
---|
10 2 0 9 9 2 4 10 10 5 0 6 |
correct output |
---|
2 2 |
user output |
---|
2 2 |
Test 26
Verdict: WRONG ANSWER
input |
---|
10 9 10 3 2 9 0 0 4 1 10 6 |
correct output |
---|
2 7 |
user output |
---|
1 3 |
Test 27
Verdict: WRONG ANSWER
input |
---|
10 0 2 8 3 4 10 7 5 10 3 5 |
correct output |
---|
1 1 |
user output |
---|
1 2 |
Test 28
Verdict: WRONG ANSWER
input |
---|
10 9 0 10 2 9 4 5 8 2 4 0 |
correct output |
---|
2 8 |
user output |
---|
2 2 |
Test 29
Verdict: WRONG ANSWER
input |
---|
10 0 4 5 5 5 0 1 3 1 0 2 |
correct output |
---|
2 3 |
user output |
---|
2 2 |
Test 30
Verdict: WRONG ANSWER
input |
---|
100 589284011 636562059 767928733 906523440 ... |
correct output |
---|
1 12 |
user output |
---|
1 3 |
Test 31
Verdict: WRONG ANSWER
input |
---|
100 447773961 773442531 122815 137572578 324... |
correct output |
---|
2 10 |
user output |
---|
2 4 |
Test 32
Verdict: WRONG ANSWER
input |
---|
100 468145962 198730371 27838075 590195589 4... |
correct output |
---|
60 11 |
user output |
---|
61 2 |
Test 33
Verdict: WRONG ANSWER
input |
---|
100 591414746 75940262 760367934 901888416 3... |
correct output |
---|
34 14 |
user output |
---|
33 3 |
Test 34
Verdict: WRONG ANSWER
input |
---|
100 967034923 587586157 185430193 918715994 ... |
correct output |
---|
37 64 |
user output |
---|
1 50 |
Test 35
Verdict: WRONG ANSWER
input |
---|
100 238363352 59249203 934941691 892631471 2... |
correct output |
---|
34 5 |
user output |
---|
34 2 |
Test 36
Verdict: WRONG ANSWER
input |
---|
100 958701282 356460600 224848373 881788058 ... |
correct output |
---|
1 100 |
user output |
---|
1 101 |
Test 37
Verdict: WRONG ANSWER
input |
---|
100 81935403 244103473 837431430 342493821 ... |
correct output |
---|
21 3 |
user output |
---|
21 2 |
Test 38
Verdict: WRONG ANSWER
input |
---|
100 937837680 11934037 257096282 933290529 4... |
correct output |
---|
29 54 |
user output |
---|
50 19 |
Test 39
Verdict: WRONG ANSWER
input |
---|
100 11139167 391337047 538883743 535937149 ... |
correct output |
---|
2 3 |
user output |
---|
2 2 |
Test 40
Verdict: WRONG ANSWER
input |
---|
200 589284011 636562059 767928733 906523440 ... |
correct output |
---|
99 15 |
user output |
---|
99 4 |
Test 41
Verdict: WRONG ANSWER
input |
---|
200 447773961 773442531 122815 137572578 324... |
correct output |
---|
2 10 |
user output |
---|
2 2 |
Test 42
Verdict: WRONG ANSWER
input |
---|
200 468145962 198730371 27838075 590195589 4... |
correct output |
---|
60 11 |
user output |
---|
61 2 |
Test 43
Verdict: WRONG ANSWER
input |
---|
200 591414746 75940262 760367934 901888416 3... |
correct output |
---|
104 24 |
user output |
---|
104 4 |
Test 44
Verdict: WRONG ANSWER
input |
---|
200 967034923 587586157 185430193 918715994 ... |
correct output |
---|
37 111 |
user output |
---|
52 7 |
Test 45
Verdict: WRONG ANSWER
input |
---|
200 238363352 59249203 934941691 892631471 2... |
correct output |
---|
34 5 |
user output |
---|
34 3 |
Test 46
Verdict: WRONG ANSWER
input |
---|
200 958701282 356460600 224848373 881788058 ... |
correct output |
---|
1 138 |
user output |
---|
1 5 |
Test 47
Verdict: WRONG ANSWER
input |
---|
200 81935403 244103473 837431430 342493821 ... |
correct output |
---|
21 3 |
user output |
---|
21 4 |
Test 48
Verdict: WRONG ANSWER
input |
---|
200 937837680 11934037 257096282 933290529 4... |
correct output |
---|
84 66 |
user output |
---|
83 13 |
Test 49
Verdict: WRONG ANSWER
input |
---|
200 11139167 391337047 538883743 535937149 ... |
correct output |
---|
2 3 |
user output |
---|
2 2 |
Test 50
Verdict: WRONG ANSWER
input |
---|
1000 589284011 636562059 767928733 906523440 ... |
correct output |
---|
99 15 |
user output |
---|
99 3 |
Test 51
Verdict: WRONG ANSWER
input |
---|
1000 447773961 773442531 122815 137572578 324... |
correct output |
---|
2 10 |
user output |
---|
2 3 |
Test 52
Verdict: WRONG ANSWER
input |
---|
1000 468145962 198730371 27838075 590195589 4... |
correct output |
---|
60 11 |
user output |
---|
61 7 |
Test 53
Verdict: WRONG ANSWER
input |
---|
10000 591414746 75940262 760367934 901888416 3... |
correct output |
---|
104 24 |
user output |
---|
104 6 |
Test 54
Verdict: WRONG ANSWER
input |
---|
10000 967034923 587586157 185430193 918715994 ... |
correct output |
---|
3660 279 |
user output |
---|
9150 26 |
Test 55
Verdict: WRONG ANSWER
input |
---|
10000 238363352 59249203 934941691 892631471 2... |
correct output |
---|
325 9 |
user output |
---|
3588 3 |
Test 56
Verdict: WRONG ANSWER
input |
---|
100000 958701282 356460600 224848373 881788058 ... |
correct output |
---|
66493 302 |
user output |
---|
66504 12 |
Test 57
Verdict: WRONG ANSWER
input |
---|
100000 81935403 244103473 837431430 342493821 ... |
correct output |
---|
28066 7 |
user output |
---|
28066 2 |
Test 58
Verdict: WRONG ANSWER
input |
---|
100000 937837680 11934037 257096282 933290529 4... |
correct output |
---|
91851 177 |
user output |
---|
8944 8 |
Test 59
Verdict: WRONG ANSWER
input |
---|
100000 11139167 391337047 538883743 535937149 ... |
correct output |
---|
84138 4 |
user output |
---|
84138 2 |
Test 60
Verdict: WRONG ANSWER
input |
---|
100000 239756970 350744379 561742366 59793553 5... |
correct output |
---|
94284 12 |
user output |
---|
94284 2 |
Test 61
Verdict: WRONG ANSWER
input |
---|
100000 316394139 195182396 569713187 906489185 ... |
correct output |
---|
12844 13 |
user output |
---|
8937 2 |
Test 62
Verdict: WRONG ANSWER
input |
---|
100000 698334026 81615940 542726430 464528081 9... |
correct output |
---|
28811 40 |
user output |
---|
29631 3 |
Test 63
Verdict: WRONG ANSWER
input |
---|
100000 104725911 462211739 817385661 443179352 ... |
correct output |
---|
46788 9 |
user output |
---|
46788 4 |
Test 64
Verdict: WRONG ANSWER
input |
---|
100000 20 13 15 11 10 13 16 17 18 15 18 ... |
correct output |
---|
1 100000 |
user output |
---|
1 100001 |