Codeforces Beta Round 39

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
40 Codeforces Beta Round 39 FINISHED False 7200 487346380 Nov. 5, 2010, 4 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 809 ) E Number Table PROGRAMMING combinatorics 2500

As it has been found out recently, all the Berland's current economical state can be described using a simple table n × m in size. n — the number of days in each Berland month, m — the number of months. Thus, a table cell corresponds to a day and a month of the Berland's year. Each cell will contain either 1 , or -1 , which means the state's gains in a particular month, on a particular day. 1 corresponds to profits, -1 corresponds to losses. It turned out important for successful development to analyze the data on the state of the economy of the previous year, however when the treasurers referred to the archives to retrieve the data, it turned out that the table had been substantially damaged. In some table cells the number values had faded and were impossible to be deciphered. It is known that the number of cells in which the data had been preserved is strictly less than max ( n , m ) . However, there is additional information — the product of the numbers in each line and column equaled -1 . Your task is to find out how many different tables may conform to the preserved data. As the answer to the task can be quite large, you have to find it modulo p . The first line contains integers n and m ( 1 ≤ n , m ≤ 1000 ). The second line contains the integer k ( 0 ≤ k < max ( n , m ) ) — the number of cells in which the data had been preserved. The next k lines contain the data on the state of the table in the preserved cells. Each line is of the form " a b c ", where a ( 1 ≤ a ≤ n ) — the number of the table row, b ( 1 ≤ b ≤ m ) — the number of the column, c — the value containing in the cell ( 1 or -1 ). They are numbered starting from 1 . It is guaranteed that no two lines with same a and b values exist. The last line contains an integer p ( 2 ≤ p ≤ 10 9 + 7 ). Print the number of different tables that could conform to the preserved data modulo p .

Tutorials

Codeforces Beta Round #39 (Разбор задач)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
178836 tourist E Nov. 5, 2010, 4:44 p.m. OK Delphi TESTS 95 50 4915200 2500
179953 vepifanov E Nov. 5, 2010, 5:49 p.m. OK GNU C++ TESTS 95 30 1331200 2500
180071 gstefanich E Nov. 5, 2010, 5:56 p.m. OK GNU C++ TESTS 95 50 5427200 2500
179972 amir_sh E Nov. 5, 2010, 5:50 p.m. OK GNU C++ TESTS 95 50 5427200 2500
179519 venkateshb E Nov. 5, 2010, 5:21 p.m. OK GNU C++ TESTS 95 50 5427200 2500
179959 Gassa E Nov. 5, 2010, 5:50 p.m. OK GNU C++ TESTS 95 60 5427200 2500
179860 wywcgs E Nov. 5, 2010, 5:44 p.m. OK GNU C++ TESTS 95 80 9830400 2500
180182 syco E Nov. 5, 2010, 5:59 p.m. OK GNU C++ TESTS 95 360 37683200 2500
179317 Petr E Nov. 5, 2010, 5:08 p.m. OK Java 6 TESTS 95 90 43315200 2500
180128 cerealguy E Nov. 5, 2010, 5:58 p.m. OK Java 6 TESTS 95 110 43315200 2500
179908 Rei E Nov. 5, 2010, 5:46 p.m. OK Java 6 TESTS 95 110 43315200 2500
179536 Anton_Lunyov E Nov. 5, 2010, 5:22 p.m. OK MS C++ TESTS 95 30 1331200 2500
179797 dzhulgakov E Nov. 5, 2010, 5:40 p.m. OK MS C++ TESTS 95 50 1331200 2500
179744 AleX E Nov. 5, 2010, 5:36 p.m. OK MS C++ TESTS 95 50 5427200 2500

remove filters

Back to search problems