Submission #343720

# Submission time Handle Problem Language Result Execution time Memory
343720 2021-01-04T12:28:16 Z ismoilov Red-blue table (IZhO19_stones) C++14
0 / 100
34 ms 1428 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
#define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
#define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--)
#define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--)
void S()
{
	int n, m;
	cin >> n >> m;
	if(n == 1)
	{
		fpp(i,1,m)
			cout << "-";
		cout << "\n";
		return;
	}
	if(m == 1)
	{
		fpp(i,1,n)
			cout << "+\n";
		return;
	}
	if(n % 2 == 1 && m % 2 == 1)
	{
		if(m >= n)
		{
			fpp(i,1,m)
			{
				fpp(j,1,n/2)
					cout << '-';
				fpp(j,1,n/2+1)
					cout << '+';
				cout << "\n";
			}
		}
		else
		{
			fpp(i,1,m/2)
			{
				fpp(j,1,n)
					cout << '+';
				cout << "\n";
			}
			fpp(i,1,m/2+1)
			{
				fpp(j,1,n)
					cout << '-';
				cout << "\n";
			}
		}
	}
	else
	{
		if(n % 2 == 1)
		{
			fpp(i,1,n/2)
			{
				fpp(j,1,m)
					cout << '+';
				cout << "\n";
			}
			fpp(i,1,n/2+1)
			{
				fpp(j,1,m)
					cout << '-';
				cout << "\n";
			}
		}
		else
		{
			if(m % 2 == 1)
			{
				fpp(i,1,n)
				{
					fpp(j,1,m/2)
						cout << '-';
					fpp(j,1,m/2+1)
						cout << '+';
					cout << "\n";
				}
			}
			else
			{
				fpp(i,1,n)
				{
					fpp(j,1,m/2+1)
						cout << '+';
					fpp(j,1,m/2-1)
						cout << "-";
					cout << "\n";
				}
			}
		}
	}
	
}
int main()
{
	IOS;
	int t;
	cin >> t;
	while(t --)
		S();
}

Compilation message

stones.cpp: In function 'void S()':
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:16:3: note: in expansion of macro 'fpp'
   16 |   fpp(i,1,m)
      |   ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:23:3: note: in expansion of macro 'fpp'
   23 |   fpp(i,1,n)
      |   ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:31:4: note: in expansion of macro 'fpp'
   31 |    fpp(i,1,m)
      |    ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:33:5: note: in expansion of macro 'fpp'
   33 |     fpp(j,1,n/2)
      |     ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:35:5: note: in expansion of macro 'fpp'
   35 |     fpp(j,1,n/2+1)
      |     ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:42:4: note: in expansion of macro 'fpp'
   42 |    fpp(i,1,m/2)
      |    ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:44:5: note: in expansion of macro 'fpp'
   44 |     fpp(j,1,n)
      |     ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:48:4: note: in expansion of macro 'fpp'
   48 |    fpp(i,1,m/2+1)
      |    ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:50:5: note: in expansion of macro 'fpp'
   50 |     fpp(j,1,n)
      |     ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:60:4: note: in expansion of macro 'fpp'
   60 |    fpp(i,1,n/2)
      |    ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:62:5: note: in expansion of macro 'fpp'
   62 |     fpp(j,1,m)
      |     ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:66:4: note: in expansion of macro 'fpp'
   66 |    fpp(i,1,n/2+1)
      |    ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:68:5: note: in expansion of macro 'fpp'
   68 |     fpp(j,1,m)
      |     ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:77:5: note: in expansion of macro 'fpp'
   77 |     fpp(i,1,n)
      |     ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:79:6: note: in expansion of macro 'fpp'
   79 |      fpp(j,1,m/2)
      |      ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:81:6: note: in expansion of macro 'fpp'
   81 |      fpp(j,1,m/2+1)
      |      ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:88:5: note: in expansion of macro 'fpp'
   88 |     fpp(i,1,n)
      |     ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:90:6: note: in expansion of macro 'fpp'
   90 |      fpp(j,1,m/2+1)
      |      ^~~
stones.cpp:7:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
stones.cpp:92:6: note: in expansion of macro 'fpp'
   92 |      fpp(j,1,m/2-1)
      |      ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Expected integer, but "---" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Expected integer, but "-++" found
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Expected integer, but "---" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 1428 KB Expected integer, but "++++++++++++++++++++++++++++++...+++++++++++++++++++++++++++++++" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 1332 KB Expected integer, but "+++++++++++++-----------" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Expected integer, but "---" found
2 Halted 0 ms 0 KB -