Submission #159635

#TimeUsernameProblemLanguageResultExecution timeMemory
159635Dima_BorchukRed-blue table (IZhO19_stones)C++17
0 / 100
2025 ms16288 KiB
#include <bits/stdc++.h> using namespace std; int main() { int q , n , m; cin >> q; while(q--){ cin >> n >> m; int v[n + 1] = {0}, ans = m , k; char a[n + 5][m + 5]; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ a[i][j] = '-'; } } for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ if(v[j] < n / 2){ a[i][j] = '+'; v[j]++; } } } for(int i = 1; i <= n; i++){ k = 0; for(int j = 1; j <= n; j++){ if(a[i][j] == '+') k++; } if(k > m / 2) ans++; } cout << ans << endl; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ cout << a[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...