제출 #1125408

#제출 시각아이디문제언어결과실행 시간메모리
1125408zhasynRed-blue table (IZhO19_stones)C++20
26 / 100
51 ms2120 KiB
#include <bits/stdc++.h> #define pb push_back #define pf push_front using namespace std; #define F first #define S second typedef long long ll; #define pii pair <int, int> #define pll pair <ll, ll> typedef long double ld; const ll N = 1000 + 100, M = 500 + 10, len = 315, inf = 1e18; const ll mod = 998244353; ll um(ll a, ll b){ return (1LL * a * b) % mod; } ll subr(ll a, ll b){ return ((1LL * a - b) % mod + mod) % mod; } ll bp(ll x, ll step){ ll res = 1; while(step){ if(step & 1) res = um(res, x); x = um(x, x); step /= 2; } return res; } ll inv(ll x){ return bp(x, mod - 2); } ll n, m; char arr[N][N]; int main() { //ios_base::sync_with_stdio(false); //cin.tie(nullptr); //cout.tie(nullptr); int tt; cin >> tt; while(tt--){ cin >> n >> m; int mx = 0, a, b; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ arr[i][j] = '+'; } } for(int i = 0; i <= n; i++){ int cur = i + min((n * m - (m/2 + 1) * i) / (n/2 + 1), m); if(cur > mx){ mx = cur; a = i; b = (n * m - (m/2 + 1) * i) / (n/2 + 1); } } cout << mx << endl; //cout << a << " "<< b << endl; for(int i = 0; i < n - a; i++){ for(int j = 0; j < m; j++){ arr[i][j] = '-'; } } int start = n - a; for(int j = 0; j < b; j++){ //cout << n/2 + 1 - a << endl; for(int i = 0; i < (n/2 + 1) - (n - a); i++){ //cout << start << " " << j << endl; arr[start][j] = '-'; if(++start == n) start = n - a; } } for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cout << arr[i][j]; } cout << endl; } } 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...