Submission #1093908

# Submission time Handle Problem Language Result Execution time Memory
1093908 2024-09-28T04:51:36 Z Muhammet Red-blue table (IZhO19_stones) C++17
0 / 100
18 ms 1372 KB
#include <bits/stdc++.h>

using namespace std;

vector <vector <char>> a;

int main(){
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int T;
	cin >> T;
	while(T--){
		int n, m;
		cin >> n >> m;
		a.assign(n, vector <char> (m,'+'));
		if(m >= n){
			int n1 = (n/2)+1;
			for(int j = 0; j < m; j++){
				for(int i = 0; i < n1; i++){
					a[i][j] = '-';
				}
			}
		}
		int ans = 0;
		for(int i = 0; i < n; i++){
			int a1 = 0, b1 = 0;
			for(int j = 0; j < m; j++){
				if(a[i][j] == '+') a1++;
				else b1++;
			}
			ans += (a1 > b1);
		}
		int ans1 = ans;
		for(int j = 0; j < m; j++){
			int a1 = 0, b1 = 0;
			for(int i = 0; i < n; i++){
				if(a[i][j] == '+') a1++;
				else b1++;
			}
			ans += (b1 > a1);
		}
		cout << ans << '\n';
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				cout << a[i][j];
			}
			cout << '\n';
		}
	}
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:32:7: warning: unused variable 'ans1' [-Wunused-variable]
   32 |   int ans1 = ans;
      |       ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Wrong answer in test 4 3: 4 < 5
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong answer in test 4 3: 4 < 5
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Wrong answer in test 4 3: 4 < 5
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1372 KB Wrong answer in test 97 21: 97 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1372 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 344 KB Output is correct
2 Incorrect 0 ms 348 KB Wrong answer in test 4 3: 4 < 5
3 Halted 0 ms 0 KB -