Submission #343664

# Submission time Handle Problem Language Result Execution time Memory
343664 2021-01-04T10:51:39 Z mglstew Red-blue table (IZhO19_stones) C++17
0 / 100
76 ms 1644 KB
#include <bits/stdc++.h>
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define N 100005
#define ccin cin >>
#define ccout cout <<
 
using namespace std;

char a[2000][2000];
int col[2000];
int row[2000];
     
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
    int t;
    ccin t;
    while(t--){
    	int n, m;
    	ccin n >> m;
    	int ans = max(n, m);
    	if(n > m){
    		for(int i = 0; i < n; i++){
    			for(int j = 0; j < m; j++){
    				a[i][j] = '+';
    				row[i] = m;
    			}
    		}
    		for(int i = 0; i < m; i++){
    			int l = 0;
    			for(int j = 0; j < n; j++){
    				if(l >= n / 2 + n % 2){
    					break;
    				}
    				if(row[j] - 1 >= m / 2 + m % 2){
    					a[j][i] = '-';
    					row[j]--;
    					l++;
    				}
    			}
    			if(l == n / 2 + n % 2){
    				ans++;
    			}
    		}
    			
    	}
    	else{
    		for(int i = 0; i < n; i++){
    			for(int j = 0; j < m; j++){
    				a[i][j] = '-';
    				col[j] = n;
    			}
    		}
    		for(int i = 0; i < n; i++){
    			int l = 0;
    			for(int j = 0; j < m; j++){
    				if(l >= m / 2 + m % 2){
    					break;
    				}
    				if(col[j] - 1 >= n / 2 + n % 2){
    					a[i][j] = '+';
    					col[j]--;
    					l++;
    				}
    			}
    			if(l == m / 2 + m % 2){
    				ans++;
    			}
    		}
    	}
    	ccout ans << endl;
    	for(int i = 0; i < n; i++){
    		for(int j = 0; j < m; j++){
    			ccout a[i][j];
    		}
    		ccout endl;
    	}
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 512 KB in the table A+B is not equal to 6
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 492 KB in the table A+B is not equal to 22
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 512 KB in the table A+B is not equal to 6
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 1644 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 1644 KB in the table A+B is not equal to 48
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 512 KB in the table A+B is not equal to 6