Submission #466631

#TimeUsernameProblemLanguageResultExecution timeMemory
466631TeaTimeRed-blue table (IZhO19_stones)C++17
27 / 100
38 ms1272 KiB
//#pragma GCC optimize("O3") //#pragma GCC target("avx2") #include <iostream> #include <vector> #include <string> #include <algorithm> #include <map> #include <set> #include <queue> #include <unordered_map> #include <cmath> using namespace std; #define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); typedef long long ll; typedef long double ld; const ll SZ = 1e6 + 100, INF = 1e9, AM = 2, K = 26; const vector<ll> P = { 1774, 177 }; const vector<ll> MOD = { ll(1e9 + 7), ll(1e9 + 9) }; ll n, m; signed main() { fastInp; ll t; cin >> t; while (t--) { cin >> n >> m; if (m <= n) { cout << n + (m - 1) / 2 << "\n"; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if ((j + 1) * 2 < m) { cout << "-"; } else { cout << "+"; } } cout << "\n"; } } else { cout << m + (n - 1) / 2 << "\n"; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (i == n - 1 && (n % 2) == 0) { cout << "-"; continue; } if (i % 2 == 0) { cout << "-"; } else { cout << "+"; } } cout << "\n"; } } } 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...