Submission #384195

# Submission time Handle Problem Language Result Execution time Memory
384195 2021-03-31T17:48:19 Z ritul_kr_singh Red-blue table (IZhO19_stones) C++17
11 / 100
34 ms 1388 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << ' ' << 
#define nl << '\n'

signed main(){
    cin.tie(0)->sync_with_stdio(0);
    int T; cin >> T;
    while(T--){
    	int n, m; cin >> n >> m;
    	if(n==1){
    		cout << m nl;
    		while(m--) cout << '-';
    		cout nl;
    	}else if(m==1){
    		cout << n nl;
    		while(n--) cout << '+' nl;
    	}else{
	    	cout << n + m - 2 nl;
	    	for(int i=0; i<n; ++i){
	    		for(int j=0; j<m; ++j){
	    			if(i and j) cout << ((i+j) % 2 ? '+' : '-');
	    			else cout << (i ? '+' : '-');
	    		}
	    		cout nl;
	    	}
	    }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 4
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB in the table A+B is not equal to 20
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB in the table A+B is not equal to 4
# Verdict Execution time Memory Grader output
1 Correct 34 ms 1388 KB Output is correct
2 Correct 30 ms 1260 KB Output is correct
3 Correct 29 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 1388 KB in the table A+B is not equal to 46
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 364 KB in the table A+B is not equal to 4