Submission #490190

#TimeUsernameProblemLanguageResultExecution timeMemory
490190ismoilovRed-blue table (IZhO19_stones)C++14
100 / 100
24 ms2252 KiB
#include<bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) typedef long long int ll; void S() { int n, m; cin >> n >> m; bool swaped = 0; char red = '+', blue = '-'; if(n < m) swap(n, m), swaped = 1, swap(red, blue); char a[n][m]; for(int i = 0; i < n; i ++) for(int j = 0; j < m; j ++) a[i][j] = red; int ans = n, cnt = 0; for(int k = 0; k < (m-1)/2; k ++){ for(int i = 0; i < n; i ++){ a[i][ans-n] = blue; cnt ++; // cout << cnt << " "; if(cnt == (n/2)+1) ans ++, cnt = 0;//, cout << cnt << " ", cnt = 0; } } cout << ans << "\n"; if(!swaped){ for(int i = 0; i < n; i ++){ for(int j = 0; j < m; j ++) cout << a[i][j]; cout << "\n"; } } else{ for(int i = 0; i < m; i ++){ for(int j = 0; j <n; j ++) cout << a[j][i]; cout << "\n"; } } } int main() { IOS; int t; cin >> t; while(t --) S(); }
#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...