Submission #532498

#TimeUsernameProblemLanguageResultExecution timeMemory
532498syl123456Red-blue table (IZhO19_stones)C++17
27 / 100
3 ms1228 KiB
#include <bits/stdc++.h>
#define all(i) (i).begin(), (i).end()
using namespace std;
void Debug(bool _split) {}
template<typename T1, typename ...T2>
void Debug(bool _split, T1 i, T2 ...j) {
    if (_split)
        cerr << ", ";
    cerr << i;
    Debug(true, j...);
}
#define debug(args...) cerr << "Line(" << __LINE__ << ") : [" << #args << "] is [", Debug(false, args), cerr << "]" << endl
template<typename T1, typename T2>
ostream& operator << (ostream& i, pair<T1, T2> j) {
    return i << '(' << j.first << ", " << j.second << ')';
}

typedef long long ll;
typedef pair<int, int> pi;
const int inf = 0x3f3f3f3f, lg = 20;
const ll mod = 1e9 + 7, INF = 0x3f3f3f3f3f3f3f3f;

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        int n, m;
        cin >> n >> m;
        int x = m + n - (n + 2 >> 1), y = m + n - (m + 2 >> 1);
        if (x >= y) {
            cout << x << '\n';
            for (int i = 0; i < n + 2 >> 1; ++i)
                cout << string(m, '-') << '\n';
            for (int i = n + 2 >> 1; i < n; ++i)
                cout << string(m, '+') << '\n';
        }
        else {
            cout << y << '\n';
            for (int i = 0; i < n; ++i)
                cout << string(m + 2 >> 1, '+') << string(m - (m + 2 >> 1), '-') << '\n';
        }
    }
}

Compilation message (stderr)

stones.cpp: In function 'int main()':
stones.cpp:30:28: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   30 |         int x = m + n - (n + 2 >> 1), y = m + n - (m + 2 >> 1);
      |                          ~~^~~
stones.cpp:30:54: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   30 |         int x = m + n - (n + 2 >> 1), y = m + n - (m + 2 >> 1);
      |                                                    ~~^~~
stones.cpp:33:35: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   33 |             for (int i = 0; i < n + 2 >> 1; ++i)
      |                                 ~~^~~
stones.cpp:35:28: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   35 |             for (int i = n + 2 >> 1; i < n; ++i)
      |                          ~~^~~
stones.cpp:41:34: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   41 |                 cout << string(m + 2 >> 1, '+') << string(m - (m + 2 >> 1), '-') << '\n';
      |                                ~~^~~
stones.cpp:41:66: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   41 |                 cout << string(m + 2 >> 1, '+') << string(m - (m + 2 >> 1), '-') << '\n';
      |                                                                ~~^~~
#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...