Submission #330729

# Submission time Handle Problem Language Result Execution time Memory
330729 2020-11-26T12:05:36 Z tavhid Red-blue table (IZhO19_stones) C++14
17 / 100
75 ms 1516 KB
#include <bits/stdc++.h>

//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define int long long int
#define dl double long

using namespace std;

const int N = 1e6 + 7;
const int INF = 1e10 + 7;
const int mod = 998244353;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve1()
{
    int n, m;
    char a = '+', b = '-';
    bool f = false;
    cin >> n >> m;
    if(n < m){
        swap(a, b);
        f = true;
    }
    int k = (min(n, m) * max(n, m)) - (min(n, m) / 2 + 1) * max(n, m);
    cout << max(n, m) + k / max(n, m) << endl;
    char ar[n + 10][m + 10];
    for(int i = 0; i < k / m && f; i++){
        for(int j = 0; j < m; j++){
            ar[i][j] = b;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < k / n && !f; j++){
            ar[i][j] = b;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(ar[i][j] != b){
                cout << a;
            }else{
                cout << b;
            }
        }
        cout << endl;
    }
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );
	//freopen( "cupboard.in" , "r" , stdin );
    //freopen( "cupboard.out" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 364 KB in the table A+B is not equal to 50
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 10 ms 364 KB in the table A+B is not equal to 50
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 1516 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 1436 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 10 ms 364 KB in the table A+B is not equal to 50