Task: | Zigzag |
Sender: | NewbieWillFall |
Submission time: | 2015-09-16 17:39:44 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.06 s | details |
#2 | WRONG ANSWER | 0.07 s | details |
#3 | WRONG ANSWER | 0.10 s | details |
#4 | WRONG ANSWER | 0.06 s | details |
#5 | WRONG ANSWER | 0.07 s | details |
#6 | WRONG ANSWER | 0.08 s | details |
#7 | WRONG ANSWER | 0.07 s | details |
#8 | WRONG ANSWER | 0.08 s | details |
#9 | WRONG ANSWER | 0.07 s | details |
#10 | WRONG ANSWER | 0.08 s | details |
#11 | WRONG ANSWER | 0.08 s | details |
#12 | WRONG ANSWER | 0.08 s | details |
#13 | WRONG ANSWER | 0.09 s | details |
#14 | WRONG ANSWER | 0.08 s | details |
#15 | WRONG ANSWER | 0.10 s | details |
#16 | WRONG ANSWER | 0.09 s | details |
#17 | WRONG ANSWER | 0.08 s | details |
#18 | WRONG ANSWER | 0.08 s | details |
#19 | WRONG ANSWER | 0.08 s | details |
#20 | WRONG ANSWER | 0.07 s | details |
#21 | WRONG ANSWER | 0.07 s | details |
#22 | WRONG ANSWER | 0.11 s | details |
#23 | WRONG ANSWER | 0.05 s | details |
Code
#include <iostream> using namespace std; #define MAX 100000 int main() { int len; cin >> len; int sequence[MAX]; for (int i = 0; i < len; i++) cin >> sequence[i]; for (int i = 0; i < len; i++) cout << sequence[i] << " "; cout << "\n"; int max_len = 2, current_len = 2; bool prev_larger = false; if (sequence[0] < sequence[1]) prev_larger = false; if (sequence[0] > sequence[1]) prev_larger = true; for (int i = 1; i < len; i++) { for (int j = i + 1; j < len; j++) if (sequence[j - 1] > sequence[j] && prev_larger == false) { current_len++; prev_larger = true; } else if (sequence[j - 1] < sequence[j] && prev_larger == true) { current_len++; prev_larger = false; } else { if (max_len < current_len) max_len = current_len; current_len = 2; if (sequence[j - 1] > sequence[j]) { prev_larger = true; i = j; } else if (sequence[j - 1] < sequence[j]) { prev_larger = false; i = j; } else i = j + 1; } } cout << max_len << "\n"; return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
26914
209563339 493138663 352519700 ... |
correct output |
---|
17861 |
user output |
---|
209563339 493138663 352519700 ... |
Test 2
Verdict: WRONG ANSWER
input |
---|
69623
448426297 297876050 307483466 ... |
correct output |
---|
46402 |
user output |
---|
448426297 297876050 307483466 ... |
Test 3
Verdict: WRONG ANSWER
input |
---|
74436
633012861 731816315 697620472 ... |
correct output |
---|
49602 |
user output |
---|
633012861 731816315 697620472 ... |
Test 4
Verdict: WRONG ANSWER
input |
---|
40279
561990353 513856090 901866509 ... |
correct output |
---|
26955 |
user output |
---|
561990353 513856090 901866509 ... |
Test 5
Verdict: WRONG ANSWER
input |
---|
51496
683270487 631068160 190804676 ... |
correct output |
---|
34326 |
user output |
---|
683270487 631068160 190804676 ... |
Test 6
Verdict: WRONG ANSWER
input |
---|
97124
1000007 1000006 1000003 100000... |
correct output |
---|
61495 |
user output |
---|
1000007 1000006 1000003 100000... |
Test 7
Verdict: WRONG ANSWER
input |
---|
91945
1000005 1000005 1000006 100000... |
correct output |
---|
58521 |
user output |
---|
1000005 1000005 1000006 100000... |
Test 8
Verdict: WRONG ANSWER
input |
---|
96629
1000004 1000010 1000003 100001... |
correct output |
---|
61327 |
user output |
---|
1000004 1000010 1000003 100001... |
Test 9
Verdict: WRONG ANSWER
input |
---|
92161
1000042 1000001 1000055 100001... |
correct output |
---|
60962 |
user output |
---|
1000042 1000001 1000055 100001... |
Test 10
Verdict: WRONG ANSWER
input |
---|
96806
1000057 1000002 1000011 100006... |
correct output |
---|
64127 |
user output |
---|
1000057 1000002 1000011 100006... |
Test 11
Verdict: WRONG ANSWER
input |
---|
99118
1000084 1000083 1000002 100008... |
correct output |
---|
66012 |
user output |
---|
1000084 1000083 1000002 100008... |
Test 12
Verdict: WRONG ANSWER
input |
---|
98412
1000959 1000993 1000257 100064... |
correct output |
---|
65720 |
user output |
---|
1000959 1000993 1000257 100064... |
Test 13
Verdict: WRONG ANSWER
input |
---|
90443
1000341 1000111 1000853 100021... |
correct output |
---|
60148 |
user output |
---|
1000341 1000111 1000853 100021... |
Test 14
Verdict: WRONG ANSWER
input |
---|
94265
1000087 1000461 1000534 100020... |
correct output |
---|
62824 |
user output |
---|
1000087 1000461 1000534 100020... |
Test 15
Verdict: WRONG ANSWER
input |
---|
91433
1001939 1009857 1000325 100505... |
correct output |
---|
60938 |
user output |
---|
1001939 1009857 1000325 100505... |
Test 16
Verdict: WRONG ANSWER
input |
---|
96457
1005466 1001970 1000639 100288... |
correct output |
---|
64111 |
user output |
---|
1005466 1001970 1000639 100288... |
Test 17
Verdict: WRONG ANSWER
input |
---|
91928
1003162 1008129 1007967 100683... |
correct output |
---|
61129 |
user output |
---|
1003162 1008129 1007967 100683... |
Test 18
Verdict: WRONG ANSWER
input |
---|
96494
1076481 1008804 1047323 102583... |
correct output |
---|
64214 |
user output |
---|
1076481 1008804 1047323 102583... |
Test 19
Verdict: WRONG ANSWER
input |
---|
98136
1025253 1017437 1050227 105377... |
correct output |
---|
65345 |
user output |
---|
1025253 1017437 1050227 105377... |
Test 20
Verdict: WRONG ANSWER
input |
---|
90294
1098032 1037085 1089672 105311... |
correct output |
---|
60164 |
user output |
---|
1098032 1037085 1089672 105311... |
Test 21
Verdict: WRONG ANSWER
input |
---|
100000
19836 85811 67650 86807 50191 ... |
correct output |
---|
66639 |
user output |
---|
19836 85811 67650 86807 50191 ... |
Test 22
Verdict: WRONG ANSWER
input |
---|
100000
999999998 999999999 999999996 ... |
correct output |
---|
59975 |
user output |
---|
999999998 999999999 999999996 ... |
Test 23
Verdict: WRONG ANSWER
input |
---|
11
1000000000 1000000000 10000000... |
correct output |
---|
4 |
user output |
---|
1000000000 1000000000 10000000... |