이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define pb push_back
#define int long long int
#define endl '\n'
#define MOD (int)(1e9 + 7)
#define all(x) x.begin(), x.end()
#define mid start+(end-start)/2
#define debug(x) cerr << #x << " = " << x << endl
#define binary(x) cerr << #x << " = " << bitset<8>(x) << endl
#define N (int)(1e3)+5
int t,n,m;
char mat[N][N];
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
cin >> t;
for(int i = 0; i < t; i++){
cin >> n >> m;
int na = n, ma = m;
if(ma >= na){
for(int j = 1; j <= ma; j++){
for(int k = 1; k <= na; k++){
if(k <= ((na+2)/2)) mat[j][k] = '-';
else mat[j][k] = '+';
}
}
}
else{
for(int j = 1; j <= na; j++){
for(int k = 1; k <= ma; k++){
if(k <= ((ma+1)/2)) mat[k][j] = '+';
else mat[k][j] = '-';
}
}
}
int ans = 0, atlar = 0, ekler = 0;
for(int j = 1; j <= n; j++){
for(int k = 1; k <= m; k++){
if(mat[k][j] == '+') atlar++;
else ekler++;
}
if(atlar > ekler) ans++;
atlar = 0, ekler = 0;
}
atlar = 0, ekler = 0;
for(int j = 1; j <= m; j++){
for(int k = 1; k <= n; k++){
if(mat[j][k] == '+') atlar++;
else ekler++;
}
if(ekler > atlar) ans++;
atlar = 0, ekler = 0;
}
cout << ans << endl;
for(int j = 1; j <= n; j++){
for(int k = 1; k <= m; k++){
cout << mat[k][j];
}
cout << endl;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |