Submission #646441

#TimeUsernameProblemLanguageResultExecution timeMemory
646441murad_2005Red-blue table (IZhO19_stones)C++14
27 / 100
33 ms1248 KiB
#include<bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2") #pragma GCC optimize("unroll-loops") #define ll long long #define ld long double #define ull unsigned long long #define ui unsigned int #define eb emplace_back #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define pb push_back #define pf push_front #define pii pair<int, int> #define pil pair<int, ll> #define plli pair<long long, int> #define pdi pair<double, int> #define pldldi pair<ld, pair<ld, int>> #define pdd pair<double, double> #define pid pair<int, double> #define piii pair<int, pair<int, int>> #define pllll pair<long long, long long> #define pllllll pair<ll, pllll> #define INF 2e9 + 5 #define size(v) v.size() #define f first #define s second #define Pi 3.14159265359 using namespace std; int Choice1(int n, int m){ int x = n / 2; if(x * 2 == n){ x--; } return x + m; } int Choice2(int n, int m){ int x = m / 2; if(x * 2 == m){ x--; } return x + n; } void solve(){ int n, m; cin >> n >> m; if(Choice1(n, m) > Choice2(n, m)){ cout << Choice1(n, m) << "\n"; int x = Choice1(n, m) - m; vector<vector<char>>grid(n + 1, vector<char>(m + 1, '-')); for(int i = 1; i <= x; i++){ for(int j = 1; j <= m; j++){ grid[i][j] = '+'; } } for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ cout << grid[i][j]; } cout << "\n"; } }else{ cout << Choice2(n, m) << "\n"; int x = Choice2(n, m) - n; vector<vector<char>>grid(n + 1, vector<char>(m + 1, '+')); for(int i = 1; i <= x; i++){ for(int j = 1; j <= n; j++){ grid[j][i] = '-'; } } for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ cout << grid[i][j]; } cout << "\n"; } } } int main(){ int t; // t = 1; 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...