제출 #488206

#제출 시각아이디문제언어결과실행 시간메모리
488206OttincaMRed-blue table (IZhO19_stones)C++14
27 / 100
33 ms1256 KiB
#include <iostream> #include <vector> #include <map> #include <unordered_map> #include <set> #include <deque> #include <algorithm> #include <string.h> #include <string> #include <cmath> #include <climits> #include <queue> #include <fstream> #include <iomanip> using namespace std; #define all(x) (x).begin(), (x).end() #define int long long #define ll long long #define ff first #define ss second #define MP make_pair #define pb push_back #define pf push_front #define db double ll gcd(ll a,ll b){ return b == 0 ? a : gcd(b, a % b); } ll lcm(ll a,ll b){ return a / gcd(a, b) * b; } ll binary_power(ll a,ll n){ ll res = 1; while(n){ if(n & 1) -- n, res = res * a; else a = a * a, n >>= 1; } return res; } ll phi(ll n) { ll result = n; for (ll i = 2; i * i <= n; ++i) if (n % i == 0) { while (n % i == 0) n /= i; result -= result / i; } if (n > 1) result -= result / n; return result; } /*<______________________________________________>*/ const int MOD = 1e9 + 7; const int INF = 1000000101; const long long LLINF = 1223372000000000555; char chang(char a){ if(a == '+') return '-'; return '+'; } void t_main(){ int n, m, res, cnt; cin >> n >> m; char a = '+'; if(n < m) a = '-'; vector <vector<char>> g(n + 1, vector <char> (m + 1, a)); if(m == n){ res = m; cnt = (m + 1) / 2 - 1; res += cnt; for(int i = 1; i <= n; i ++) for(int j = 1; j <= cnt; j ++) g[i][j] = chang(g[i][j]); cout << res << "\n"; for(int i = 1; i <= n; i ++){ for(int j = 1; j <= m; j ++) cout << g[i][j]; cout << "\n"; } } else if(n < m){ res = m; cnt = (n + 1) / 2 - 1; res += cnt; for(int i = 1; i <= cnt; i ++) for(int j = 1; j <= m; j ++) g[i][j] = chang(g[i][j]); cout << res << "\n"; for(int i = 1; i <= n; i ++){ for(int j = 1; j <= m; j ++) cout << g[i][j]; cout << "\n"; } } else{ res = n; cnt = (m + 1) / 2 - 1; res += cnt; for(int i = 1; i <= n; i ++) for(int j = 1; j <= cnt; j ++) g[i][j] = chang(g[i][j]); cout << res << "\n"; for(int i = 1; i <= n; i ++){ for(int j = 1; j <= m; j ++) cout << g[i][j]; cout << "\n"; } } } signed main(){ //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tt = 1; cin >> tt; while(tt --) t_main(); 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...