Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Hint | So Sui Ming | 1346. Интервалы монотонности | 10 янв 2024 11:37 | 1 |
Hint So Sui Ming 10 янв 2024 11:37 Get rid of consecutive duplicates which are nasty and note that the intervals do not share common point. dp is not needed. |
Some tests to clear problem definition (+) | Dmitry 'Diman_YES' Kovalioff | 1346. Интервалы монотонности | 4 июн 2023 15:29 | 19 |
I've solved this problem finally, of course, but I still suppose its definition to be unclear a bit :) So some tests for you: 1 3 1 1 1 1 // 1 5 1 2 3 4 5 // 1 5 5 4 3 3 3 1 // 1 7 1 2 2 3 3 4 5 1 // 1 5 1 2 3 2 1 2 // 1 6 1 2 3 2 3 4 2 - that's the point! // 1 6 3 2 1 4 4 5 2 // 1 6 1 2 1 2 1 2 3 // 1 6 1 2 3 1 2 1 3 Thank you. I've solved this problem finally too. The problem statement is quite ambiguous. Thank you for clarification. Thank you for tests! Who has problem with test 9 - use test 1 12 1 2 3 3 2 1 1 2 3 4 5 4 Answer - 4 Thanks! Problem statement really lacks definition for flat slopes... Thanks! Если честно, то условие ваще дурацкое. >> 1 6 1 2 3 2 3 4 2 - that's the point! >> Why so? =( I know, that problem of my solution in this but don't understand.. I think it should be 3. cause it can be divided in (1,2,3) and (2,3,4) > 1 6 > 1 2 3 2 3 4 Well, I see, it can be divided into (1, 2, 3) and (2, 3, 4). But I don't see anything in the statement, that restricts me to divide into (1, 2), (3, 2), (3, 4). Does this mean, that complexity should be minimal? Then why cant it be divided into (1,2) , (3,2) , (3) , (4) ? Because (1,2) , (3,2) , (3) , (4) = complexity 4 is not optimal Less complexity is: (1,2) , (3,2) , (3,4) = complexity 3 Optimal is: (1,2,3) , (2,3,4) = complexity 2 It is not necessary to connect point #3 and point #4 Hi! 1 3 2 10 5 ->2 * 1 5 20 20 200 20 200 ->2 * 1 5 1 2 2 1 1 ->2 * WA#21 MOPDOBOPOT (USU) 15 сен 2012 23:32 This test helped me to overcome WA21: input: 1 7 2 2 1 2 2 1 2 output: 3 Thanks for the test cases. Agreed. The problem is easy, but the sample I/O is very misleading. |
to admins: | esbybb | 1346. Интервалы монотонности | 13 дек 2022 01:33 | 2 |
hi, this is O(1) complexity problem, you might want to decrease the Difficulty i guess to others: if you have found an extremum skip next point That's what I thought too ... the difficulty could be decreased by half at least. Maybe even more. |
WA 28 ??? | Aleksander | 1346. Интервалы монотонности | 16 июн 2021 21:18 | 4 |
Why WA 28?I don't understand. Here is my code: program gjkh; var a,b,ch,n,i,kol,sh,fir,sec,thi:longint; m:array[1..100001]of longint; flag:boolean; begin read(a);readln(b); n:=0; while not seekeof do begin read(ch); if (n=0)or(m[n]<>ch)then begin n:=n+1; m[n]:=ch; end; end; flag:=true; kol:=1; for i:=1 to n do begin if (i=1)then fir:=m[i] else begin if (flag=true)then begin sec:=m[i]; flag:=false; end else begin thi:=m[i]; if ((thi-sec)*(sec-fir)>0)then begin fir:=sec;sec:=thi; end else begin fir:=thi; kol:=kol+1; flag:=true; end; end; end; end; writeln(kol); end. 1 5 -100000 500000 -70000 800000 -80000 answ: 3 Edited by author 01.02.2010 18:44 Input numbers must not exceed 100000 by absolute value. why is 3, because there are 4 intervals? |
All forum test passed, by wa21 | MassterMax🤔`~ | 1346. Интервалы монотонности | 12 июл 2020 07:04 | 2 |
It can help you: Test: 1 13 0 -10 -7 -10 1 -5 6 -10 -8 -8 -7 -10 1 Answer: 6 Edited by author 04.04.2018 15:40 |
WA25 | Ulugbek#& | 1346. Интервалы монотонности | 2 май 2020 20:37 | 2 |
WA25 Ulugbek#& 30 апр 2020 09:32 does anybody have idea what it can be? Just retype your code in other language. For ex. C++, and you'll get AC. The reason is this site hates python and java coders :( Don't stop reading while not EOF Edited by author 02.05.2020 20:40 |
small hint | md | 1346. Интервалы монотонности | 4 ноя 2017 16:54 | 3 |
Remove repetitions before applying your algo i.e.: sequences like 2 1 2 2 2 2 1 change into 2 1 2 1 It helped me with WA#21 Yep. For understanding why, lets consider: 1 7 3 2 1 4 4 5 They should be 7 numbers in the list! |
if you get WA #21 | notbot | 1346. Интервалы монотонности | 17 мар 2017 09:00 | 1 |
I resolved WA21 using this case: 1 5 1 1 2 3 4 Correct Answer => 1 the problem with my solution was initialisation of the slope in case the first 2 elements are equal. |
Solved WA #21 with the following test | yeguzi | 1346. Интервалы монотонности | 24 окт 2016 21:21 | 1 |
|
wa #29 :(( | Tusnad Nobrovirski | 1346. Интервалы монотонности | 28 сен 2016 01:23 | 3 |
could you give me some tricky tests please? i tried everything that came through my mind. Thanks. I also experienced WA #29 (and WA #21 during attempts to fix it). IMHO, these tests have equal numbers in the end. My data cases. For WA29: > 1 4 > 1 2 1 1 For WA21: > 1 6 > 1 6 3 2 1 1 Increase your arrays length... |
if WA28 | gamepro | 1346. Интервалы монотонности | 5 дек 2015 12:02 | 1 |
|
greedy | hliu20 | 1346. Интервалы монотонности | 23 май 2013 13:38 | 1 |
greedy hliu20 23 май 2013 13:38 the turning point should be left to LAST group. |
DP problem? | Andrew Sboev | 1346. Интервалы монотонности | 4 сен 2012 14:39 | 2 |
I don't know how to solve this problem with DP, because here is just a one cycle without any cool thinking) Where is a DP here?) It's just a easy problem. Edited by author 04.09.2012 14:40 Edited by author 04.09.2012 14:40 |
The statement is bad | Alexey Dergunov [Samara SAU] | 1346. Интервалы монотонности | 3 июн 2012 19:59 | 2 |
Function is not (strictly) increasing or decreasing, it is NON-DECREASING or NON-INCREASING. Test: 1 6 1 1 2 2 3 3 Answer: 1, not 4! |
If you have WA#21 | JTim | 1346. Интервалы монотонности | 10 авг 2010 14:30 | 6 |
input: -3 3 2 2 1 2 2 1 output: 2 your test is wrong 'cause A must be >=0 This tests can help you: 1 3 2 2 1 2 2 1 1 1 3 1 1 2 2 2 1 1 This tests can help you: 1 3 2 2 1 2 2 1 1 1 3 1 1 2 2 2 1 1 I think, that your test's are not correct.Second line must contain f(1),f(2),f(3) and no more. Try tests: 1 9 1 2 1 2 3 2 1 2 1 4 1 10 1 2 1 2 1 0 1 2 1 2 5 1 7 1 2 1 2 1 0 1 5 My solution is greedy. One boolean, one counter and list of nonrecurring array of numbers, but i think, that we can work with numbers during reading. Nice problem :) > 1 7 > 1 2 1 2 1 0 1 > 5 How can that be true? (1, 2), (1, 2), (1, 0), (1) - this means, that answer should be 4. |
And anothe input... | Bandera | 1346. Интервалы монотонности | 10 мар 2010 19:01 | 2 |
What I must print if sample input 1 5 1 2 3 4 5 |
Problem input | Nick Permyakov | 1346. Интервалы монотонности | 24 янв 2009 01:00 | 4 |
Input for this problem, as well as the sample input, contains \xE2\x80\x93 UTF-8 sequence at the beginning of negative numbers, doesn't it? Edited by author 04.08.2005 17:33 Admins, check please sample input. If I'm copy text from browser, I got answer 2 because number -1 (and next numbers) NOT READ. But if this input I'm enter from keyboard, I got answer 3. Sorry for my bad english. Edited by author 16.01.2009 19:04 ... OpenGL 23 янв 2009 14:07 |
WA #5 | sc92 | 1346. Интервалы монотонности | 5 апр 2007 20:14 | 1 |
WA #5 sc92 5 апр 2007 20:14 could anyone help me with test number 5 or give some tests for which my solution gives wrong answer? I have checked all the tests from the webboard. |
9 | ФерПИ_3 | 1346. Интервалы монотонности | 4 авг 2006 13:20 | 3 |
9 ФерПИ_3 19 фев 2005 15:16 who can tell me what is the test #2? Re: 9 33687GH 19 фев 2005 15:19 Re: 9 DonNTU Team (Akulshin, Belikov, Trofimenko) 4 авг 2006 13:20 cin >> beg >> en; en = en-beg+1; |
I'm WA in #21. Can somebody help me ? Thanks a lot . | Short_gun | 1346. Интервалы монотонности | 21 дек 2005 09:15 | 1 |
Here is my code : Const tfi = ''; tfo = ''; max = 10000 + 1; Type arr1I = array [0..max] of integer ; Var f : arr1I ; a,b : integer ; res : integer ; fi,fo : text ; Procedure Readfile; Var i : integer ; Begin Assign(fi,tfi); Reset(fi); Readln(fi,a,b); For i := a to b do read(fi,f[i]); Close(fi); End; {--------------------------------------------------------------------} Procedure Process; Var i,x,j : integer ; Begin res := 1; If b - a = 1 then exit; res := 0; i := a; Repeat Inc(res); If f[i] <= f[i + 1] then Begin x := f[i + 1]; j := i + 1; Repeat If x <= f[j + 1] then Begin x := f[j + 1]; Inc(j); End Else break; If j = b then exit; Until false; i := j + 1; End Else Begin x := f[i + 1]; j := i + 1; Repeat If x >= f[j + 1] then Begin x := f[j + 1]; Inc(j); End Else break; If j = b then exit; Until false; i := j + 1; End; If i = b then Begin Inc(res); break; End; Until i > b; End; {--------------------------------------------------------------------} Procedure Writefile; Begin Assign(fo,tfo); Rewrite(fo); Writeln(fo,res); Close(fo); End; {--------------------------------------------------------------------} Begin Readfile; Process; Writefile; End. Edited by author 21.12.2005 09:16 |