답안 #857022

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
857022 2023-10-05T08:58:45 Z elotelo966 Red-blue table (IZhO19_stones) C++17
0 / 100
18 ms 1372 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 1000000005
#define mod 1000000007
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mid (start+end)/2
#define lim 1000005
//char di[lim][lim],di2[lim][lim],di3[lim][lim],di4[lim][lim];
int32_t main(){
    faster
    int t;cin>>t;
    while(t--){
        int n,m;cin>>n>>m;
        if(n/2+m>=m/2+n){
            if(n&1){
                cout<<n/2+m<<'\n';
                for(int i=0;i<n;i++){
                    if(!(i&1)){
                        for(int j=0;j<m;j++)cout<<'-';
                    }
                    else {for(int j=0;j<m;j++)cout<<'+';}
                    cout<<'\n';
                }
            }
            else{
                
                int deg=n-2;
                cout<<abs(deg)/2+m<<'\n';
                for(int i=0;i<deg;i++){
                    if(!(i&1)){
                        for(int j=0;j<m;j++)cout<<'-';
                    }
                    else for(int j=0;j<m;j++)cout<<'+';
                    cout<<'\n';
                }
                deg=abs(deg);
                if(n-deg>=2){
                    for(int j=0;j<m;j++)cout<<'-';
                    cout<<'\n';
                }
                deg=abs(deg-1);
                if(n-deg>=1){
                    for(int j=0;j<m;j++)cout<<'-';
                    cout<<'\n';
                }
                
            }
            
        }
        else{
            if(m&1){
                cout<<m/2+n<<'\n';
                for(int i=0;i<n;i++){
                   for(int j=0;j<m;j++){
                       if(!(j&1)){
                           cout<<'+';
                       }
                       else cout<<'-';
                   }
                   cout<<'\n';
                }
            }
            else{
                int deg=n-2;
                cout<<abs(deg)/2+m<<'\n';
                for(int i=0;i<deg;i++){
                    for(int j=0;j<m;j++){
                       if(!(j&1)){
                           cout<<'+';
                       }
                       else if(j==m-1)cout<<'+'; 
                       else cout<<'-';
                   }
                   cout<<'\n';
                }
                
            }
            
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Wrong answer in test 2 1: 1 < 2
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Wrong answer in test 2 1: 1 < 2
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Wrong answer in test 2 1: 1 < 2
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 1372 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 1368 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Wrong answer in test 2 1: 1 < 2
3 Halted 0 ms 0 KB -