Submission #502054

#TimeUsernameProblemLanguageResultExecution timeMemory
502054MazaalaiRed-blue table (IZhO19_stones)C++17
Compilation error
0 ms0 KiB
#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 (stderr)

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];
      |                       ^