| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | jiangly | 3670 |
| 3 | Kevin114514 | 3657 |
| 4 | maroonrk | 3355 |
| 5 | Um_nik | 3353 |
| 6 | squareOf105 | 3346 |
| 7 | tourist | 3343 |
| 8 | strapple | 3324 |
| 9 | heuristica | 3322 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | AmShZ | 143 |
| 5 | Um_nik | 141 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 133 |
| 8 | maroonrk | 133 |
| 10 | qwexd | 130 |
|
0
1 4 4 1 4 2 3 3 4 2 4 Your code print 'No suspcious bugs found' but it should print 'Suspcious bugs found', because 2->3->4->2 is an odd-length cycle, and so the graph is not bipartite. Your mistake is here: "if visited[v] == 0: bipartite(adj, color, v)" You have to return -1 if at some time bipartite returned -1, not just call it. This way: "if visited[v] == 0: if bipartite(adj, color, v) == -1: return -1" The reason is simple, if you return -1 after the first call, it won't return the answer. Your code did right in the sample tests because it returns -1 in the first call. http://ideone.com/By2nVd I fix it, but now it gaves TLE. |
|
0
I can't solve it during the contest due to a small mistake. But i did it right after the ending of the contest :/ If n = 3, output 1 3 if n = 5 output 2 2 3 else since n is odd, n — 3 is even, and then we can use strong goldbach conjecture to solve the problem. Every number N even, greater than 2, can be written as sum of two primes. Since n — 3 is even, we can find this two primes that added form n — 3 and then add it to 3, which is prime. output 3 3 prime[i] (N — 3 — prime[i]) I used Sieve of Eratosthenes to find primes between 2 and 10^7, and if some number K didn't fit in this interval, I test it's primality by brute force. And used binary search to try to find N — 3 — prime[i] in vector of primes; |
|
0
Maybe because you just checked if you could put "2 * qua" for boys. You didn't check if you could put "qua" for girls... That's the same mistake I've made... You have to check it because it could happen that you can put 2 * qua for boys, but the smallest cup doesn't support qua ml of water. |
|
0
Thats really weird... Here both codes ended up in TLE |
| Name |
|---|


