# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
168182 | 2019-12-11T20:09:48 Z | munhorgil | Red-blue table (IZhO19_stones) | C++14 | 37 ms | 1272 KB |
#include<bits/stdc++.h> #define pb push_back using namespace std; int main() { int n , m , i , j , t , a , b , ans; vector < char > temp; vector < vector < char > > A; cin >> t; while(t > 0) { cin >> n >> m; A.clear(); for(i = 0 ; i < n ; i++) { temp.clear(); for(j = 0 ; j < m ; j++) { temp.pb('+'); } A.pb(temp); } if(min(n , m) > 6) { if(n % 2 == 0) a = n - 2; else a = n - 1; if(m % 2 == 0) b = m - 2; else b = m - 1; ans = a + b; for(i = 0 ; i < a / 2 ; i++) { for(j = 0 ; j < b / 2 ; j++) { A[i][j] = '-'; A[i + a / 2][j + b / 2] = '-'; } } for(i = a ; i < n ; i++) { for(j = 0 ; j < m ; j++) { A[i][j] = '-'; } } } else { if(min(n , m) < 5) { ans = max(n , m) + (min(n , m) - 1) / 2; if(n < m) { for(i = 0 ; i < n - ((n - 1) / 2) ; i++) { for(j = 0 ; j < m ; j++) { A[i][j] = '-'; } } } else { for(i = 0 ; i < n ; i++) { for(j = 0 ; j < (m - 1) / 2 ; j++) { A[i][j] = '-'; } } } } else { ans = n + m - min(n , m) / 2; if(n < m) { for(i = 0 ; i < m ; i++) { a = i % 3; A[a][i] = '-'; } for(i = 3 ; i < n ; i++) { for(j = 0 ; j < m ; j++) { A[i][j] = '-'; } } } else { for(i = 0 ; i < n ; i++) { for(j = 0 ; j < b ; j++) { A[i][j] = '-'; } } for(i = 0 ; i < n ; i++) { a = i % 3; A[i][a] = '+'; } } } } cout << ans << endl; for(i = 0 ; i < n ; i++) { for(j = 0 ; j < m ; j++) { cout << A[i][j]; } cout << endl; } t--; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 14 ms | 376 KB | Output is correct |
4 | Incorrect | 24 ms | 376 KB | in the table A+B is not equal to 40 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 37 ms | 1272 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 14 ms | 376 KB | Output is correct |
4 | Incorrect | 24 ms | 376 KB | in the table A+B is not equal to 40 |