Submission #500833

# Submission time Handle Problem Language Result Execution time Memory
500833 2022-01-01T11:21:49 Z EliteCallsYou Red-blue table (IZhO19_stones) C++17
0 / 100
40 ms 1232 KB
# include <bits/stdc++.h>
using namespace std ;
//############################################################################
# define read(a)/**/for(int i=0;i<int(sizeof(a)/sizeof(a[0]));i++){cin>>a[i];}
# define print(x)/**/for(auto zx:x){cout<<zx<<' ';}
const char* tochar(string a){return a.c_str();}
void files(){freopen("planting.in","r",stdin);freopen("planting.out","w",stdout);}
void speed(){ios_base::sync_with_stdio(false);cin.tie(0);}
long long gcd(long long a,long long b){if(!b){return a;}a%=b;return gcd(b,a);}
long long lcm(long long a,long long b){return a /gcd(a,b) * b;}
//###########################################################################
const int N = 3e5 + 5 ;
const long long MOD = 1e17+7 ;
//###########################################################################
void hack(){
	int n, m ; cin >> n >> m ;
	cout << max(n,m)+min(n,m)/2 << '\n' ;
	if ( n >= m ){
		for ( int i = 0 ; i < n ; i ++ ){
			for ( int j = 0 ; j < m ; j ++ ){
				if ( !(j%2) ){
					cout << '+' ;
				}
				else{
					cout << '-' ;
				}
			}cout << '\n' ;
		}
	}
	else{
		for ( int i = 0 ; i < n ; i ++ ){
			for ( int j = 0 ; j < m ; j ++ ){
				if ( !(i%2) ){
					cout << '-' ;
				}
				else{
					cout << '+' ;
				}
			}cout << '\n' ;
		}
	}
}
//###########################################################################
int main(){
	int t ; cin >> t ;
	while ( t -- ){hack();}
}	

Compilation message

stones.cpp: In function 'void files()':
stones.cpp:7:21: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | void files(){freopen("planting.in","r",stdin);freopen("planting.out","w",stdout);}
      |              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
stones.cpp:7:54: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | void files(){freopen("planting.in","r",stdin);freopen("planting.out","w",stdout);}
      |                                               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
2 Incorrect 0 ms 292 KB in the table A+B is not equal to 5
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB in the table A+B is not equal to 21
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
2 Incorrect 0 ms 292 KB in the table A+B is not equal to 5
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 1232 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 1160 KB in the table A+B is not equal to 36
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
2 Incorrect 0 ms 292 KB in the table A+B is not equal to 5