Submission #685095

#TimeUsernameProblemLanguageResultExecution timeMemory
685095yhlasRed-blue table (IZhO19_stones)C++14
0 / 100
23 ms1284 KiB
#include <iostream> //#include <algorithm> //#include <math.h> //#include <queue> //#include <stack> //#include <vector> //#include <map> //#include <set> //#include <iomanip> using namespace std; //#include <ext/pb_ds/assoc_container.hpp> //using namespace __gnu_pbds; //typedef tree<ll,null_type,less<int>,rb_tree_tag, //tree_order_statistics_node_update> indexed_set; #define fbo find_by_order #define ofk order_of_key #define gg 500005 #define ll long long #define ull unsigned ll #define ld long double #define pii pair<int,int> #define pll pair<ll,ll> #define vi vector<int> #define vll vector<ll> #define stll stack<ll> #define qll queue<ll> #define pqll priority_queue<ll> #define pq priority_queue #define pb push_back #define ub upper_bound #define lb lower_bound #define issq(x) (((ll)(sqrt((x))))*((ll)(sqrt((x))))==(x)) #define ff first #define ss second #define lg(r,n) (int)(log2(n)/log2(r)) #define rev(v) reverse(v.begin(),v.end()) #define srt(v) sort(v.begin(),v.end()) #define srtr(v) sort(v.rbegin(),v.rend()); #define all(v) v.begin(),v.end() #define allr(v) v.rbegin(), v.rend() #define mnv(v) *min_element(v.begin(),v.end()) #define mxv(v) *max_element(v.begin(),v.end()) #define countv(v,a) count(v.begin(),v.end(),a) #define sz(x) (int)x.size() int main() { ios::sync_with_stdio(0); cin.tie(0); int _; cin >> _; while ( _--) { int n, m; cin >> n >> m; char a[n + 1][m + 1]; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) a[i][j] = '-'; int mx = max(n, m), mn = min(n, m), ans = mx + (mn + 1) / 2; if ( mn == 1 ){ if ( m == 1 ) for (int i = 1; i <= n; i++) a[i][1] = '+'; cout << mx << '\n'; for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++) cout << a[i][j]; cout << '\n'; } continue; } int x = mn>>1; cout << mx - 1 + x * 2 << '\n'; for (int i = 1; i <= x; i++) for (int j = 2; j <= mx; j += 2){ if ( mn == m ) a[j][i] = a[j - 1][i + x] = '+'; else a[i][j] = a[i + x][j - 1] = '+'; } for (int i = 1; i <= mn; i++){ if ( mn == m ) a[mx][i] = '+'; else a[i][mx] = '+'; } for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++) cout << a[i][j]; cout << "\n"; } } } //could_solve_myself:)

Compilation message (stderr)

stones.cpp: In function 'int main()':
stones.cpp:68:45: warning: unused variable 'ans' [-Wunused-variable]
   68 |         int mx = max(n, m), mn = min(n, m), ans = mx + (mn + 1) / 2;
      |                                             ^~~
#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...