Submission #172648

# Submission time Handle Problem Language Result Execution time Memory
172648 2020-01-02T09:27:01 Z LinusTorvaldsFan Red-blue table (IZhO19_stones) C++14
0 / 100
51 ms 1656 KB
#include <bits/stdc++.h>

using namespace std;

char f[2000][2000];

int ver[2000];
int hor[2000];


int main() {
	int t;
	cin>>t;
	for(;t;t--){
		int n,m;
		cin>>n>>m;
		int ans=max(n,m);
		if(n>m){
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					f[i][j]='+';
					hor[i]=m;
				}
			}
			for(int j=0;j<m;j++){
				int t=0;
				for(int i=0;i<n;i++){
					if(t>=n/2+n%2)break;
					if(hor[i]-1>=m/2+m%2){
						f[i][j]='-';
						hor[i]--;
						t++;
					}
				}
				if(t==n/2+n%2)ans++;
			}
				
		} else{
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					f[i][j]='-';
					ver[j]=n;
				}
			}
			for(int i=0;i<n;i++){
				int t=0;
				for(int j=0;j<m;j++){
					if(t>=m/2+m%2)break;
					if(ver[j]-1>=n/2+n%2){
						f[i][j]='+';
						ver[j]--;
						t++;
					}
				}
				if(t==n/2+n%2)ans++;
			}
		}
		cout<<ans<<endl;
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				cout<<f[i][j];
			}
			cout<<"\n";
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB in the table A+B is not equal to 4
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB in the table A+B is not equal to 45
# Verdict Execution time Memory Grader output
1 Correct 1 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB in the table A+B is not equal to 4
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 1544 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 1656 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 376 KB Output is correct
2 Incorrect 2 ms 376 KB in the table A+B is not equal to 4