제출 #1122791

#제출 시각아이디문제언어결과실행 시간메모리
1122791TestTestovRed-blue table (IZhO19_stones)C++20
0 / 100
7 ms4420 KiB
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define vii vector<vi> #define ff first #define ss second #define vi vector<int> #define ll long long #define pii pair<int, int> #define EPS 1e-7 #define hashsize(n) ((int)1<<(n)) #define hashmask(n) (hashsize(n)-1) #define cmin(a, b) a = min(a, b) #define cmax(a, b) a = max(a, b) #define forn(i,n) for(int i=0; i<(int)n; i++) #define rep(i, a, b) for(int i = a; i < (b); ++i) #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") const ll MOD = 1e9+7; const ll md2=998244353; const int MAXN = 2e5+10; const ll INF = 2*1e9; const int maxn = 2e5+10, maxn2=maxn+1000; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template <typename T> using sett = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template <typename T> using multisett = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; namespace io { template <typename T, typename F> istream &operator>>(istream &cin, pair<T, F> &pr) { cin >> pr.first >> pr.second; return cin; } template <typename T, typename F> ostream &operator<<(ostream &cout, pair<T, F> &pr) { cout << pr.first << ' ' << pr.second; return cout; } template <typename T> istream &operator>>(istream &cin, vector<T> &vec) { for (T &i : vec) cin >> i; return cin; } template <typename T> ostream &operator<<(ostream &cout, vector<T> vec) { for (T i : vec) cout << i << ' '; return cout; } } using namespace io; class SparseTable { private: vector<vector<int>> st; vector<int> log; public: SparseTable(const vector<int>& a) { int n = a.size(); log.resize(n + 1); log[1] = 0; for (int i = 2; i <= n; ++i) log[i] = log[i / 2] + 1; int k = log[n]; st.assign(n, vector<int>(k + 1)); for (int i = 0; i < n; ++i) st[i][0] = a[i]; for (int j = 1; j <= k; ++j) { for (int i = 0; i + (1 << j) <= n; ++i) { st[i][j] = max(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]); } } } int query(int l, int r) { int j = log[r - l + 1]; return max(st[l][j], st[r - (1 << j) + 1][j]); } }; vector<long long> fact(MAXN + 1), inv_fact(MAXN + 1); ll power(ll base, ll exp) { ll res = 1; while (exp > 0) { if (exp % 2) { res = (res * base)%MOD; } base = (base * base)%MOD; exp /= 2; } return res%MOD; } void precompute(ll max_n) { fact[0] = 1; for (ll i = 1; i <= max_n; ++i) { fact[i] = fact[i - 1] * i % MOD; } inv_fact[max_n] = power(fact[max_n], MOD - 2); for (ll i = max_n - 1; i >= 0; --i) { inv_fact[i] = inv_fact[i + 1] * (i + 1) % MOD; } } long long binomial_coefficient(ll n, ll k) { if (k > n || k < 0) { return 0; } return fact[n] *inv_fact[k] % MOD * inv_fact[n - k] % MOD; } bool isprime(int m) { if (m <= 1) return false; for (int i = 2; i * i <= m; i++) { if (m % i == 0) return false; } return true; } int oaat(vi key, int len, int bits) { int hash = 0; for (int i = 0; i < len; i++) { hash += key[i]; hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash & hashmask(bits); } vector<int> z_function(string s) { int n = s.size(); vector<int> z(n); int l = 0, r = 0; for (int i = 1; i < n; i++) { if (i < r) { z[i] = min(r - i, z[i - l]); } while (i + z[i] < n && s[z[i]] == s[i + z[i]]) { z[i]++; } if (i + z[i] > r) { l = i; r = i + z[i]; } } return z; } int query(int a,int b,int k=0){ cout<<"? "<<a<<" "<<b<<endl; cin>>k; return k; } void solve() { int n,m; cin>>n>>m; string v; if(n%2==1 && m%2==1){ if(m>=n){ for(int i=0;i<max(n/2,1);i++){ for(int j=0;j<m;j++){ v+='-'; } v+='\n'; } for(int i=0;i<1 && n!=1;i++){ for(int j=0;j<m;j++){ v+='+'; } v+='\n'; } for(int i=0;i<n/2;i++){ for(int j=0;j<m;j++){ v+='-'; } v+='\n'; } } else{ for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(j==m/2){ v+='-'; continue; } v+='+'; } v+='\n'; } } } else{ if(n>=m){ for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ v+='+'; } v+='\n'; } } else{ for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ v+='-'; } v+='\n'; } } } cout<<v; return; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); precompute(MAXN); int t=1; cin >> t; while (t--) { solve(); 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...