Submission #170248

# Submission time Handle Problem Language Result Execution time Memory
170248 2019-12-24T11:06:38 Z bgspartan Red-blue table (IZhO19_stones) C++14
0 / 100
30 ms 1528 KB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll maxN=1001;
char table[maxN][maxN];
void fillTable(ll n,ll m){
    ll mod=n/2+1,rep=m-(m/2+1);
    if(m>2){
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(j<rep*((i/mod)+1) and j>=rep*(i/mod)){
                table[i][j]='-';
            }else{
                table[i][j]='+';
            }
        }
    }
    }else{
        for(int i=0;i<n;i++){
                for(int j=0;j<m;j++){
            table[i][j]='+';
                }
        }
    }
}
ll n[maxN],m[maxN];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
ll t,ans1=0,ans2=0;
cin>>t;
for(int i=0;i<t;i++){
    cin>>n[i]>>m[i];
}
for(int i=0;i<t;i++){
    ll lef1=0,lef2;
    lef1=m[i]-(m[i]/2+1);
    lef2=n[i]-(n[i]/2+1);
    ans1=n[i]+lef1;
    ans2=m[i]+lef2;
    cout<<lef1<<" "<<lef2<<"\n";
   // cout<<ans1<<" "<<ans2<<"\n";
    if(ans1>=ans2){
              fillTable(n[i],m[i]);
         cout<<ans1<<"\n";

        for(int j=0;j<n[i];j++){
            for(int h=0;h<m[i];h++){
                cout<<table[j][h];
            }
            cout<<"\n";
        }
    }else{
        fillTable(m[i],n[i]);
       cout<<ans2<<"\n";
     for(int j=n[i]-1;j>=0;j--){
        for(int h=0;h<m[i];h++){
            if(table[h][j]=='-'){
                cout<<"+";
            }else{
                cout<<"-";
            }
        }
        cout<<"\n";
       }

    }
}
return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Wrong answer
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 1528 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 1528 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Wrong answer
2 Halted 0 ms 0 KB -