Submission #1093917

#TimeUsernameProblemLanguageResultExecution timeMemory
1093917MuhammetRed-blue table (IZhO19_stones)C++17
0 / 100
18 ms1512 KiB
#include <bits/stdc++.h> using namespace std; vector <vector <char>> a; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--){ int n, m; cin >> n >> m; a.assign(n, vector <char> (m,'+')); if(n+(((m+1)/2)-1) <= m+(n-(n/2)+1)){ int n1 = (n/2)+1; for(int j = 0; j < m; j++){ for(int i = 0; i < n1; i++){ a[i][j] = '-'; } } } else { int m1 = ((m+1)/2)-1; for(int i = 0; i < n; i++){ for(int j = 0; j < m1; j++){ a[i][j] = '-'; } } } int ans = 0; for(int i = 0; i < n; i++){ int a1 = 0, b1 = 0; for(int j = 0; j < m; j++){ if(a[i][j] == '+') a1++; else b1++; } ans += (a1 > b1); } for(int j = 0; j < m; j++){ int a1 = 0, b1 = 0; for(int i = 0; i < n; i++){ if(a[i][j] == '+') a1++; else b1++; } ans += (b1 > a1); } cout << ans << '\n'; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cout << a[i][j]; } cout << '\n'; } } }
#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...