Submission #331653

#TimeUsernameProblemLanguageResultExecution timeMemory
331653AKikoRed-blue table (IZhO19_stones)C++14
27 / 100
55 ms1388 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 < m - 1; j ++) { if(j & 1) { res[i][j] = '-'; } else { res[i][j] = '+'; } } } 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 < n - 1; j++) { if(j & 1) res[j][i] = '+'; else res[j][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...