Submission #683384

# Submission time Handle Problem Language Result Execution time Memory
683384 2023-01-18T09:59:15 Z Onur_Ilgaz Red-blue table (IZhO19_stones) C++17
27 / 100
22 ms 1440 KB
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long
#define inf 1e18
using namespace std;
bool grid[1001][1001];

void solve(){
	int n, m;
	cin>>n>>m;
	bool whobig=n>m;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			grid[i][j]=whobig; //1 + demek, 0 -
		}
	}
	int k=(min(n, m)-1)/2, sutun=1, satir=1;
	int ans=0;
	for(int i=1; i<=k; i++){
		if(whobig){ //satır sayısı sütun sayısından fazla ise
			int cnt=0;
			for(int j=1; j<=n; j++){
				grid[j][sutun]=0;
				cnt++;
				if(cnt == n/2+1){
					cnt=0;
					sutun++;
					ans++;
				}
			}
		}
		else{
			int cnt=0;
			for(int j=1; j<=m; j++){
				grid[satir][j]=1;
				cnt++;
				if(cnt == m/2+1){
					cnt=0;
					satir++;
					ans++;
				}
			}
		}
	}
	ans+=max(n, m);
	cout<<ans<<"\n";
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(grid[i][j]){
				cout<<'+';
			}
			else cout<<'-';
		}
		cout<<"\n";
	}
}

int32_t main(){
	fast
	#ifdef Local
    freopen("in","r",stdin);
    freopen("out","w",stdout);
    #endif
	int t=1;
	cin>>t;
	while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Incorrect 2 ms 340 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1344 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1440 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Incorrect 2 ms 340 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -