이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define Kultivator ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const LL Mxn = 1e6 + 7;
const LL Mod = 1e9 + 7;
const LL Inf = 1e14 + 7;
int main() {
    Kultivator;
    int tt;
    cin >> tt;
    while(tt--){
        int N, M;
        cin >> N >> M;
        if(min(N, M) == 1){
            cout << max(N, M) << '\n';
            for(int i = 1; i <= N; i++){
                for(int j = 1; j <= M; j++){
                    if(N == 1){
                        cout << '+';
                    } else {
                        cout << '-';
                    }
                }
                cout << '\n';
            }
            continue;
        } else if(N == 2 || M == 2){
            cout << max(N, M) << '\n';
            for(int i = 1; i <= N; i++){
                for(int j = 1; j <= M; j++){
                    if(N == 2){
                        cout << '+';
                    } else {
                        cout << '-';
                    }
                }
                cout << '\n';
            }
            continue;
        }
        cout << max(N, M) + 1 << '\n';
        if(N <= M){
            for(int i = 1; i <= N; i++){
                for(int j = 1; j <= M; j++){
                    if(i == N){
                        cout << '-';
                    } else {
                        cout << '+';
                    }
                }
                cout << '\n';
            }
        } else {
            for(int i = 1; i <= N; i++){
                for(int j = 1; j <= M; j++){
                    if(i == N){
                        cout << '+';
                    } else {
                        cout << '-';
                    }
                }
                cout << '\n';
            }
        }
        cout << '\n';
    }
}
| # | 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... |