# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
781368 | 2023-07-13T04:44:15 Z | ZHIRDILBILDIZ | Red-blue table (IZhO19_stones) | C++14 | 39 ms | 328 KB |
#include<bits/stdc++.h> using namespace std ; int func() { } int main() { ios_base::sync_with_stdio( 0 ) ; cin.tie( 0 ) ; cout.tie( 0 ) ; int t ; cin >> t ; while(t--) { int n, m, mx = 0 ; cin >> n >> m ; char c[n][m] ; if(n * m <= 16) { char ans[n][m] ; for(int x = 0 ; x < (1 << (n * m)) ; x++) { int st[m] = {}, str[n] = {}, sum = 0 ; for(int i = 0 ; i < n ; i++) for(int j = 0 ; j < m ; j++) if(x & (1 << (i * m + j))) { str[i]++ ; c[i][j] = '+' ; } else { st[j]++ ; c[i][j] = '-' ; } for(int i = 0 ; i < n ; i++) if(str[i] > m / 2)sum++ ; for(int i = 0 ; i < m ; i++) if(st[i] > n / 2)sum++ ; if(mx < sum) { for(int i = 0 ; i < n ; i++) for(int j = 0 ; j < m ; j++) ans[i][j] = c[i][j] ; } mx = max(mx, sum) ; } cout << mx << '\n' ; for(int i = 0 ; i < n ; i++) { for(int j = 0 ; j < m ; j++) cout << ans[i][j] ; cout << '\n' ; } } } return 0 ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 7 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 39 ms | 300 KB | Wrong answer |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 7 ms | 212 KB | Output is correct |
3 | Incorrect | 39 ms | 300 KB | Wrong answer |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 212 KB | Wrong answer |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 328 KB | Wrong answer |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 7 ms | 212 KB | Output is correct |
3 | Incorrect | 39 ms | 300 KB | Wrong answer |
4 | Halted | 0 ms | 0 KB | - |