31.07.2015 Views

LITHUANIAN OLYMPIADS INFORMATICS

LITHUANIAN OLYMPIADS INFORMATICS

LITHUANIAN OLYMPIADS INFORMATICS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

written from the first position of line. There are no spaces between the terms of statement.There is a semicolon (;) at the end of each statement (without any space).Output. The first line of the output file should contain NO, if it is impossible toreduce sequence so that after executing it the value of the last statement would beequal to S, or word YES, if it is possible to do this. In this case in the further lineswrite the numbers of remaining (i.e. not crossed out) statements, one statement perline (it is assumed that the statements are numerated in the order of their appearancein the input file starting from 1).ExampleInput Output Explanation124n:=n*2;m:=n+1;n:=n*3;k:=n+6;YESP134After executing the sequence (which must containthe last (fourth) statement, we must obtain 12. Ifwe cross out the second statement (in this case itdoes not even matter), then we will see that theresult is really 12. (After executing the firststatement, value of n becomes equal to 2, afterexecuting the third one – 6 and after the fourth –124n:=n*2;m:=n+1;n:=n*0;k:=n+6;94n:=n*2;n:=n+1;n:=n+2;k:=n+4;value of k becomes equal to 12).NO The value of k should become equal to 12.Therefore the final value of n should be 6. Thethird and the first statement change value ofvariable n. After executing the third statement thevalue of n becomes equal to 0, and after executingthe first one it becomes equal to 2. There are noother possibilities to change the value of n; In thiscase we the answer is NOYES1234In this case we must take all the statements of thethe initial sequence (otherwise the final value of kwould be less than 9).Restrictions1. Number of statements in the input file does not exceed 22.2. In test cases the statements will be such that overflow will never (e.g., aftercrossing out any part of the sequence and executing the remaining statements) occur.STAGE III, PART II37JUNIOR DIVISION218. Table (Runtime limit – to 10 sec.; processor Pentium 133 MHz). The tableof numbers consists of 4 rows and N columns (N ≤ 20). The table can contain only the

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!