답안 #493291

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
493291 2021-12-10T19:53:02 Z nickmet2004 Red-blue table (IZhO19_stones) C++11
27 / 100
43 ms 1328 KB
#include<bits/stdc++.h>

using namespace std;
const int N = 1005;
int n ,m;
void solve(){
    cin >> n >> m;
    char a[n+5][m+5];
    if(n >= m){
        int x = m/2;
        if(m%2==0)--x;
        cout << n + x<<endl;
        for(int i = 0; i < n; ++i){
            for(int j = 0; j< x; ++j)a[i][j] = '-';
        }
        for(int i = 0; i <n; ++i){
            for(int j =x; j < m; ++j)a[i][j] = '+';
        }
    }else{
        int x = n/2;
        if(n % 2==0)--x;
        cout << m + x << endl;
        for(int i = 0; i < x; ++i){
            for(int j =0; j < m; ++j) a[i][j] = '+';
        }
        for(int i= x; i < n; ++i){
            for(int j = 0;j  <m; ++j)a[i][j] = '-';
        }
    }
    for(int i = 0; i <n; ++i){
        for(int j = 0; j < m; ++j)cout << a[i][j];cout<<endl;
    }
}
int main (){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t;
    cin >> t;
    while(t--)solve();
return 0;
}

Compilation message

stones.cpp: In function 'void solve()':
stones.cpp:31:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   31 |         for(int j = 0; j < m; ++j)cout << a[i][j];cout<<endl;
      |         ^~~
stones.cpp:31:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   31 |         for(int j = 0; j < m; ++j)cout << a[i][j];cout<<endl;
      |                                                   ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 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 0 ms 204 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Incorrect 11 ms 344 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 1328 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 1220 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 0 ms 204 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Incorrect 11 ms 344 KB Wrong answer in test 5 29: 31 < 32