제출 #341620

#제출 시각아이디문제언어결과실행 시간메모리
341620antin_kuntinRed-blue table (IZhO19_stones)C++17
0 / 100
36 ms1516 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...