Submission #493291

#TimeUsernameProblemLanguageResultExecution timeMemory
493291nickmet2004Red-blue table (IZhO19_stones)C++11
27 / 100
43 ms1328 KiB
#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 (stderr)

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;
      |                                                   ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...