# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
286864 | dvdg6566 | Red-blue table (IZhO19_stones) | C++14 | 31 ms | 2048 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;
#define pb emplace_back
#define mp make_pair
#define f first
#define s second
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(),x.end()
#define lb lower_bound
const int MAXN=1001;
const ll MOD=998244353;
ll A[MAXN][MAXN];
ll R,C,T;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
cin>>T;
while(T--){
cin>>R>>C;
if(R==1){
cout<<C<<'\n';
for(int i=0;i<C;++i)cout<<'-';cout<<'\n';
continue;
}else if(C==1){
cout<<R<<'\n';
for(int i=0;i<R;++i){cout<<'+';cout<<'\n';}
continue;
}
if(R%2==1&&C%2==1){
cout<<R+C-2<<'\n';
for(int i=0;i<C;++i)cout<<'-';cout<<'\n';
int h=C/2;
for(int i=1;i<R;++i){
if(i%2==1){
cout<<'+';
for(int k=0;k<h;++k)cout<<'+';
for(int k=0;k<h;++k)cout<<'-';
}else{
cout<<'+';
for(int k=0;k<h;++k)cout<<'-';
for(int k=0;k<h;++k)cout<<'+';
}
cout<<'\n';
}
}else if(R%2==0&&C%2==0){
cout<<R+C-3<<'\n';
int h=C/2;
int perow=(R-2)/2;
int tar=C-3;
int cur=0;
for(int i=0;i<R;++i){
for(int ww=0;ww<perow;++ww){
A[i][cur] = 1;
++cur;
cur%=tar;
}
}
for(int i=0;i<R;++i){
for(int j=0;j<C;++j){
if(A[i][j])cout<<'-';
else cout<<'+';
}
cout<<'\n';
}
}
// return 0;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |