Submission #331647

#TimeUsernameProblemLanguageResultExecution timeMemory
331647AKikoRed-blue table (IZhO19_stones)C++14
0 / 100
39 ms1516 KiB
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define ss second #define ff first #define pb push_back #define pii pair<int, int> #define INF INT_MAX #define debug(n) cout << #n << " = " << n << "\n"; #define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const ll MOD = 1e9 + 7; void solve() { int n, m; cin >> n >> m; vector<vector<char> > res( n, vector<char>( m ) ); if(n > m) { // more red (+) for(int i = 0; i < n; i++) { res[i][m - 1] = '+'; for(int j = 0; j + 1 < m - 1; j += 2) { res[i][j] = '+'; res[i][j + 1] = '-'; } } cout << n + (m - 1) / 2 << "\n"; } else { // more blue (-) for(int i = 0; i < m; i++) { res[n - 1][i] = '-'; for(int j = 0; j + 1 < n - 1; j+=2) { res[j][i] = '-'; res[j + 1][i] = '+'; } } cout << m + (n - 1) / 2 << "\n"; } for(auto line : res) { for(char c : line) { cout << c; } cout << "\n"; } } int main() { FAST int t; cin >> t; while (t--) { solve(); } 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...