제출 #1127890

#제출 시각아이디문제언어결과실행 시간메모리
1127890masteromar27Red-blue table (IZhO19_stones)C++20
0 / 100
71 ms1348 KiB
#include <iostream> #include <vector> using namespace std; int main() { int T; cin >> T; while (T--) { int N, M; cin >> N >> M; vector<vector<char>> table(N, vector<char>(M)); for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { if ((i + j) % 2 == 0) { table[i][j] = '+'; } else { table[i][j] = '-'; } } } int A = 0, B = 0; for (int i = 0; i < N; i++) { int redCount = 0, blueCount = 0; for (int j = 0; j < M; j++) { if (table[i][j] == '+') redCount++; else blueCount++; } if (redCount > blueCount) A++; } for (int j = 0; j < M; j++) { int redCount = 0, blueCount = 0; for (int i = 0; i < N; i++) { if (table[i][j] == '+') redCount++; else blueCount++; } if (blueCount > redCount) B++; } cout << A + B << endl; for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { cout << table[i][j]; } cout << endl; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...