Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
|---|---|---|---|---|---|---|
| 10 | Codeforces Beta Round 10 | FINISHED | False | 7200 | 504972880 | April 15, 2010, 3:45 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 2047 ) | B | Cinema Cashier | PROGRAMMING | dp implementation | 1600 |
All cinema halls in Berland are rectangles with K rows of K seats each, and K is an odd number. Rows and seats are numbered from 1 to K . For safety reasons people, who come to the box office to buy tickets, are not allowed to choose seats themselves. Formerly the choice was made by a cashier, but now this is the responsibility of a special seating program. It was found out that the large majority of Berland's inhabitants go to the cinema in order to watch a movie, that's why they want to sit as close to the hall center as possible. Moreover, a company of M people, who come to watch a movie, want necessarily to occupy M successive seats in one row. Let's formulate the algorithm, according to which the program chooses seats and sells tickets. As the request for M seats comes, the program should determine the row number x and the segment y l , y r of the seats numbers in this row, where y r - y l + 1 = M . From all such possible variants as a final result the program should choose the one with the minimum function value of total seats remoteness from the center. Say, — the row and the seat numbers of the most "central" seat. Then the function value of seats remoteness from the hall center is . If the amount of minimum function values is more than one, the program should choose the one that is closer to the screen (i.e. the row number x is lower). If the variants are still multiple, it should choose the one with the minimum y l . If you did not get yet, your task is to simulate the work of this program. The first line contains two integers N and K ( 1 ≤ N ≤ 1000, 1 ≤ K ≤ 99 ) — the amount of requests and the hall size respectively. The second line contains N space-separated integers M i from the range 1, K — requests to the program. Output N lines. In the i -th line output «-1» (without quotes), if it is impossible to find M i successive seats in one row, otherwise output three numbers x , y l , y r . Separate the numbers with a space. |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 43450 | andrewzta | B | April 15, 2010, 4:02 p.m. | OK | Delphi | TESTS | 40 | 50 | 4915200 | 1600 | |
| 43815 | GlebsHP | B | April 15, 2010, 4:18 p.m. | OK | Delphi | TESTS | 40 | 50 | 4915200 | 1600 | |
| 43987 | romanandreev | B | April 15, 2010, 4:27 p.m. | OK | Delphi | TESTS | 40 | 50 | 11059200 | 1600 | |
| 43977 | Ivan_Andr | B | April 15, 2010, 4:27 p.m. | OK | Delphi | TESTS | 40 | 60 | 819200 | 1600 | |
| 43801 | PanZverski | B | April 15, 2010, 4:17 p.m. | OK | Delphi | TESTS | 40 | 80 | 819200 | 1600 | |
| 44484 | Andrbw | B | April 15, 2010, 5:01 p.m. | OK | Delphi | TESTS | 40 | 80 | 921600 | 1600 | |
| 44449 | DanDrago | B | April 15, 2010, 4:58 p.m. | OK | Delphi | TESTS | 40 | 80 | 921600 | 1600 | |
| 43528 | Topspin26 | B | April 15, 2010, 4:05 p.m. | OK | Delphi | TESTS | 40 | 80 | 921600 | 1600 | |
| 43251 | tourist | B | April 15, 2010, 3:55 p.m. | OK | Delphi | TESTS | 40 | 90 | 6348800 | 1600 | |
| 44195 | ant.ermilov | B | April 15, 2010, 4:39 p.m. | OK | Delphi | TESTS | 40 | 130 | 921600 | 1600 | |
| 43812 | flash_mt | B | April 15, 2010, 4:18 p.m. | OK | FPC | TESTS | 40 | 50 | 1024000 | 1600 | |
| 43522 | yt_72 | B | April 15, 2010, 4:05 p.m. | OK | FPC | TESTS | 40 | 80 | 1024000 | 1600 | |
| 44082 | MaChao | B | April 15, 2010, 4:32 p.m. | OK | FPC | TESTS | 40 | 80 | 1024000 | 1600 | |
| 44464 | Oryshych | B | April 15, 2010, 4:59 p.m. | OK | FPC | TESTS | 40 | 160 | 1024000 | 1600 | |
| 43842 | SNU | B | April 15, 2010, 4:19 p.m. | OK | FPC | TESTS | 40 | 160 | 1024000 | 1600 | |
| 43982 | Boyarin | B | April 15, 2010, 4:27 p.m. | OK | FPC | TESTS | 40 | 160 | 101580800 | 1600 | |
| 44002 | Rubanenko | B | April 15, 2010, 4:28 p.m. | OK | FPC | TESTS | 40 | 220 | 1024000 | 1600 | |
| 44109 | Mark_tven | B | April 15, 2010, 4:34 p.m. | OK | FPC | TESTS | 40 | 230 | 1024000 | 1600 | |
| 44429 | Georgy | B | April 15, 2010, 4:56 p.m. | OK | FPC | TESTS | 40 | 230 | 9932800 | 1600 | |
| 43940 | rommy | B | April 15, 2010, 4:25 p.m. | OK | FPC | TESTS | 40 | 270 | 1024000 | 1600 | |
| 43579 | eduardische | B | April 15, 2010, 4:07 p.m. | OK | GNU C | TESTS | 40 | 30 | 1331200 | 1600 | |
| 43875 | -.- | B | April 15, 2010, 4:21 p.m. | OK | GNU C | TESTS | 40 | 60 | 1433600 | 1600 | |
| 43426 | LayCurse | B | April 15, 2010, 4:01 p.m. | OK | GNU C | TESTS | 40 | 80 | 1331200 | 1600 | |
| 43891 | china.zhangchenzi | B | April 15, 2010, 4:22 p.m. | OK | GNU C | TESTS | 40 | 80 | 1536000 | 1600 | |
| 44124 | tec | B | April 15, 2010, 4:35 p.m. | OK | GNU C++ | TESTS | 40 | 10 | 1331200 | 1600 | |
| 44294 | package.zaic | B | April 15, 2010, 4:46 p.m. | OK | GNU C++ | TESTS | 40 | 30 | 1331200 | 1600 | |
| 44768 | maos | B | April 15, 2010, 5:23 p.m. | OK | GNU C++ | TESTS | 40 | 30 | 1331200 | 1600 | |
| 44721 | mkut | B | April 15, 2010, 5:18 p.m. | OK | GNU C++ | TESTS | 40 | 30 | 1331200 | 1600 | |
| 44684 | MarioYC | B | April 15, 2010, 5:15 p.m. | OK | GNU C++ | TESTS | 40 | 30 | 1331200 | 1600 | |
| 44601 | RedAnt | B | April 15, 2010, 5:09 p.m. | OK | GNU C++ | TESTS | 40 | 30 | 1331200 | 1600 | |
| 44128 | emo | B | April 15, 2010, 4:35 p.m. | OK | GNU C++ | TESTS | 40 | 30 | 1331200 | 1600 | |
| 44085 | kost | B | April 15, 2010, 4:32 p.m. | OK | GNU C++ | TESTS | 40 | 30 | 1331200 | 1600 | |
| 43995 | dmitrydyatlov | B | April 15, 2010, 4:28 p.m. | OK | GNU C++ | TESTS | 40 | 30 | 1331200 | 1600 | |
| 43902 | Soultaker | B | April 15, 2010, 4:22 p.m. | OK | GNU C++ | TESTS | 40 | 30 | 1331200 | 1600 | |
| 44761 | DmitryKlenov | B | April 15, 2010, 5:22 p.m. | OK | Java 6 | TESTS | 40 | 90 | 30720000 | 1600 | |
| 44540 | S.Yesipenko | B | April 15, 2010, 5:04 p.m. | OK | Java 6 | TESTS | 40 | 90 | 30720000 | 1600 | |
| 44440 | dimozzz | B | April 15, 2010, 4:57 p.m. | OK | Java 6 | TESTS | 40 | 90 | 30720000 | 1600 | |
| 43867 | niyaznigmatul | B | April 15, 2010, 4:21 p.m. | OK | Java 6 | TESTS | 40 | 130 | 30720000 | 1600 | |
| 44368 | shindo | B | April 15, 2010, 4:52 p.m. | OK | Java 6 | TESTS | 40 | 140 | 30720000 | 1600 | |
| 44261 | artpop | B | April 15, 2010, 4:43 p.m. | OK | Java 6 | TESTS | 40 | 140 | 30720000 | 1600 | |
| 44048 | uwi | B | April 15, 2010, 4:30 p.m. | OK | Java 6 | TESTS | 40 | 140 | 30720000 | 1600 | |
| 43811 | mastersobg | B | April 15, 2010, 4:18 p.m. | OK | Java 6 | TESTS | 40 | 140 | 30720000 | 1600 | |
| 43670 | izbyshev | B | April 15, 2010, 4:11 p.m. | OK | Java 6 | TESTS | 40 | 140 | 30720000 | 1600 | |
| 44190 | Efgen | B | April 15, 2010, 4:39 p.m. | OK | Java 6 | TESTS | 40 | 160 | 30720000 | 1600 | |
| 43585 | ktuan | B | April 15, 2010, 4:07 p.m. | OK | Mono C# | TESTS | 40 | 190 | 6041600 | 1600 | |
| 44974 | fujiyama | B | April 15, 2010, 5:36 p.m. | OK | Mono C# | TESTS | 40 | 330 | 6041600 | 1600 | |
| 43978 | Hadi_Asiaie | B | April 15, 2010, 4:27 p.m. | OK | Mono C# | TESTS | 40 | 340 | 6041600 | 1600 | |
| 44246 | tanzaku | B | April 15, 2010, 4:42 p.m. | OK | Mono C# | TESTS | 40 | 420 | 6041600 | 1600 | |
| 44570 | alexander.musman | B | April 15, 2010, 5:06 p.m. | OK | MS C++ | TESTS | 40 | 30 | 1331200 | 1600 | |
| 43804 | Bogdan | B | April 15, 2010, 4:17 p.m. | OK | MS C++ | TESTS | 40 | 30 | 1433600 | 1600 | |
| 44144 | Fefer_Ivan | B | April 15, 2010, 4:36 p.m. | OK | MS C++ | TESTS | 40 | 30 | 1433600 | 1600 | |
| 43805 | Seyaua | B | April 15, 2010, 4:17 p.m. | OK | MS C++ | TESTS | 40 | 30 | 1843200 | 1600 | |
| 43916 | Edvard | B | April 15, 2010, 4:23 p.m. | OK | MS C++ | TESTS | 40 | 50 | 1331200 | 1600 | |
| 44509 | Daiver19 | B | April 15, 2010, 5:02 p.m. | OK | MS C++ | TESTS | 40 | 50 | 1331200 | 1600 | |
| 43876 | Gerald | B | April 15, 2010, 4:21 p.m. | OK | MS C++ | TESTS | 40 | 50 | 1331200 | 1600 | |
| 44363 | SPIRiT_1984 | B | April 15, 2010, 4:52 p.m. | OK | MS C++ | TESTS | 40 | 50 | 1331200 | 1600 | |
| 44323 | P___ | B | April 15, 2010, 4:48 p.m. | OK | MS C++ | TESTS | 40 | 50 | 1331200 | 1600 | |
| 43932 | MRoizner | B | April 15, 2010, 4:24 p.m. | OK | MS C++ | TESTS | 40 | 50 | 1331200 | 1600 |
Back to search problems