답안 #502054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
502054 2022-01-05T07:20:05 Z Mazaalai Red-blue table (IZhO19_stones) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h> 
#define pb push_back
#define ALL(x) x.begin(),x.end()
using namespace std;
int n, m;
char a = '+', b = '-';
const int N = 1e3+1;
char ans[N][N];
void go() {
	bool flip = 0;
	cin >> n >> m;
	if (n > m) {
		flip = 1;
		swap(n, m);
		swap(a, b);
		// reverse(ALL(s));
	}
	for (int i = 0; i < n; i++)
	for (int j = 0; j < m; j++) ans[i][j] = s[1];
	int changeCnt = m * ((n-1)/2), curLine = 0, curPick = 0;
	for (int i = 0; changeCnt>0; i++) {
		ans[curLine][i%m] = s[0];
		changeCnt--, curPick++;
		if (curPick*2 > m) {
			curLine++;
			curPick = 0;
		}
	}
	cout << m + curLine <<'\n';
	if (flip) swap(n, m), swap(a, b);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) cout << (flip ? ans[j][i] : ans[i][j]);
		cout << '\n';
	}
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	int T; cin >> T;
	while(T--) go();
}

Compilation message

stones.cpp: In function 'void go()':
stones.cpp:19:42: error: 's' was not declared in this scope
   19 |  for (int j = 0; j < m; j++) ans[i][j] = s[1];
      |                                          ^
stones.cpp:22:23: error: 's' was not declared in this scope
   22 |   ans[curLine][i%m] = s[0];
      |                       ^