Submission #329077

# Submission time Handle Problem Language Result Execution time Memory
329077 2020-11-19T00:00:40 Z mat_v Red-blue table (IZhO19_stones) C++14
27 / 100
37 ms 1388 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define mod 998244353
#define xx first
#define yy second
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
#define pii pair<int,int>


using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());


int mat[1005][1005];


void solve(){
    int n,m;
    cin >> n >> m;
    int p1 = n + (m - 1) / 2;
    int p2 = m + (n - 1) / 2;
    if(p1 > p2){
        cout << p1 << "\n";
        ff(i,1,n){
            ff(j,1,m){
                if(j <= (m-1)/2)cout << '-';
                else cout << '+';
            }
            cout << "\n";
        }
    }
    else{
        cout << p2 << "\n";
        ff(i,1,n){
            ff(j,1,m){
                if(i <= (n-1)/2)cout << '+';
                else cout << '-';
            }
            cout << "\n";
        }
    }
}

int main()
{

    ios_base::sync_with_stdio(false); cin.tie(0);

    int t;
    cin >> t;
    while(t--)solve();

    return 0;
}

Compilation message

stones.cpp: In function 'void solve()':
stones.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
stones.cpp:33:9: note: in expansion of macro 'ff'
   33 |         ff(i,1,n){
      |         ^~
stones.cpp:6:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
stones.cpp:34:13: note: in expansion of macro 'ff'
   34 |             ff(j,1,m){
      |             ^~
stones.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
stones.cpp:43:9: note: in expansion of macro 'ff'
   43 |         ff(i,1,n){
      |         ^~
stones.cpp:6:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
stones.cpp:44:13: note: in expansion of macro 'ff'
   44 |             ff(j,1,m){
      |             ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 3 ms 364 KB Wrong answer in test 5 29: 31 < 32
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 1368 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 1388 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 3 ms 364 KB Wrong answer in test 5 29: 31 < 32