Submission #170241

# Submission time Handle Problem Language Result Execution time Memory
170241 2019-12-24T10:38:00 Z bgspartan Red-blue table (IZhO19_stones) C++14
27 / 100
30 ms 1508 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;
    if(m>2){
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(i/mod==j){
                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<<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 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Incorrect 3 ms 504 KB in the table A+B is not equal to 31
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 1500 KB in the table A+B is not equal to 107
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 1508 KB in the table A+B is not equal to 35
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Incorrect 3 ms 504 KB in the table A+B is not equal to 31