답안 #492721

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
492721 2021-12-08T13:46:29 Z infertechno2 Red-blue table (IZhO19_stones) C++17
27 / 100
49 ms 1344 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int Size=1e3+10;

char ans[Size][Size];

void solve(){
    ll n,m;
    cin>>n>>m;
    if(n>m){
        for(ll i=0;i<m;i++){
            for(ll j=0;j<n;j++){
                i%2==0 ? ans[j][i]='+' : ans[j][i]='-';
            }
        }
        if(m%2==0){
            for(ll i=0;i<n;i++){
                ans[i][m-1]='+';
            }
        }
    }else{
        for(ll i=0;i<n;i++){
            for(ll j=0;j<m;j++){
                i%2==0 ? ans[i][j]='-' : ans[i][j]='+';
            }
        }
        if(n%2==0){
            for(ll i=0;i<m;i++){
                ans[n-1][i]='-';
            }
        }
    }
    cout<<max(n,m)+(min(n,m)-1)/2<<endl;
    for(ll i=0;i<n;i++){
        for(ll j=0;j<m;j++){
            cout<<ans[i][j];
        }
        cout<<endl;
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Incorrect 10 ms 416 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 49 ms 1316 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 1344 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Incorrect 10 ms 416 KB Wrong answer in test 5 29: 31 < 32