Submission #1183791

#TimeUsernameProblemLanguageResultExecution timeMemory
1183791asdfghjkRed-blue table (IZhO19_stones)C++20
27 / 100
13 ms1352 KiB
#include <bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define con continue
using  namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
const ll N = 1000 + 5;
const ll inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
int a[N][N];
void solve(){
    int n,m;cin >> n >> m;
    int res  = max(n,m) + ((min(n,m) - 1) / 2);
    cout << res << '\n';
    if(n < m){
        int q = ((n - 1) / 2);
        for(int i = 1;i <= n;i++){
            for(int j = 1;j <= m;j++){
                if(i + q <= n){
                    cout << '-';
                }
                else cout << '+';
            }
            cout << '\n';
        }
    }
    else{
        int q = ((m - 1) / 2);
        for(int i = 1;i <= n;i++){
            for(int j = 1;j <= m;j++){
                if(j + q <= m){
                    cout << '+';
                }
                else cout << '-';
            }
            cout << '\n';
        }
    }
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;cin >> t;
    while(t--){
        solve();
    }
}

Compilation message (stderr)

stones.cpp:45:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   45 | main(){
      | ^~~~
#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...