답안 #648427

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
648427 2022-10-06T11:41:04 Z mychecksedad Red-blue table (IZhO19_stones) C++17
38 / 100
33 ms 1216 KB
/* Author : Mychecksdead */
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define PI 3.1415926535
#define pb push_back
#define setp() cout << setprecision(15)
#define all(x) x.begin(), x.end()
#define oset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define debug(x) cerr << #x << " is " << x << '\n';
const int N = 1e6+100, M = 1e5+10, F = 2147483646, K = 20;


int n, m;
void solve(){
    cin >> n >> m;
    if((n-1)/2*2 + (m-1)/2*2 < max(n + (m-1)/2, m + (n-1)/2)){
        if(n >= m){
            cout << n + (m-1)/2 << '\n';
            for(int i = 0; i < n; ++i){
                for(int j = 0; j < m; ++j){
                    cout << (j<(m-1)/2 ? '-' : '+');
                }
                cout << '\n';
            }
        }else{
            cout << m + (n-1)/2 << '\n';
            for(int i = 0; i < n; ++i){
                for(int j = 0; j < m; ++j){
                    cout << (i<(n-1)/2 ? '+' : '-');
                }
                cout << '\n';
            }
        }
    }else{
        cout << (n-1)/2*2 + (m-1)/2*2 << '\n';
        for(int i = 0; i < n; ++i){
            for(int j = 0; j < m; ++j){
                if(i >= (n-1)/2*2) cout << '-';
                else if(i < (n-1)/2){
                    if(j < (m-1)/2) cout << '-';
                    else cout << '+';
                }else{
                    if(j < (m-1)/2) cout << '+';
                    else if(j < (m-1)/2*2) cout << '-';
                    else cout << '+';
                }
            }
            cout << '\n';
        }
    }
}





int main(){
    cin.tie(0); ios::sync_with_stdio(0);
    int T = 1, aa;
    cin >> T;aa=T;
    while(T--){
        // cout << "Case #" << aa-T << ": ";
        solve();
        cout << '\n';
    }
    return 0;
 
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:65:16: warning: variable 'aa' set but not used [-Wunused-but-set-variable]
   65 |     int T = 1, aa;
      |                ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 2 ms 324 KB Wrong answer in test 38 5: 40 < 41
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1216 KB Output is correct
2 Correct 24 ms 1112 KB Output is correct
3 Correct 22 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 33 ms 1184 KB Wrong answer in test 6 6: 8 < 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 2 ms 324 KB Wrong answer in test 38 5: 40 < 41
5 Halted 0 ms 0 KB -