Submission #683641

# Submission time Handle Problem Language Result Execution time Memory
683641 2023-01-19T04:21:48 Z nwgnbtb Red-blue table (IZhO19_stones) C++14
0 / 100
25 ms 1256 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back // kak push_back 5
#define endl '\n'
#define FOR(i,start,end) for(int i = start;i < end;i ++)
const ll mxn = 1e6;
ll n,m,a[mxn];
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll tt = 1;
    cin >> tt;   
    while(tt --){
        ll n,m,ans = 0;
        cin >> n >> m;
        if(n >= m){
            if(n == 1){
                cout << 1 << endl << '+' << endl;
                continue;
            }
            if(m == 1){
                cout << n << endl;
                for(int i = 0;i < n;i ++) cout << '+' << endl;
            }
            char a[n][m];
            cout << n + (m - 2) / 2 + (m - 2) % 2 << endl;
            for(int i = 0;i < n;i ++){
                cout<<'+';
                for(int j = 1;j < m - 1;j ++){
                    if(j % 2 == 1) cout << '-';
                    else cout << '+';
                }
                cout << '+' << endl;
            }
        }
        else{
            if(m == 1){
                cout << 1 << endl << '-' << endl;
                continue;
            }
            if(n == 1){
                cout << m << endl;
                for(int i = 0;i < n;i ++) cout << '-' << ' ';
                cout << endl;
            }
            char a[n][m];
            cout << m + (n - 2) / 2 + (n - 2) % 2 << endl;
            for(int i = 0;i < n;i ++){
                for(int j = 0;j < m;j ++){
                    if(i == 0 || i == n - 1){
                        cout << '-';
                    }
                    else if(i % 2 == 1) cout << '+';
                    else cout << '-';
                }
                cout << endl;
            }
        }
    }
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:27:18: warning: unused variable 'a' [-Wunused-variable]
   27 |             char a[n][m];
      |                  ^
stones.cpp:48:18: warning: unused variable 'a' [-Wunused-variable]
   48 |             char a[n][m];
      |                  ^
stones.cpp:16:16: warning: unused variable 'ans' [-Wunused-variable]
   16 |         ll n,m,ans = 0;
      |                ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB invalid character
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 1256 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1228 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Wrong answer
2 Halted 0 ms 0 KB -