Submission #209928

#TimeUsernameProblemLanguageResultExecution timeMemory
209928super_j6Red-blue table (IZhO19_stones)C++14
100 / 100
120 ms5328 KiB
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <queue> using namespace std; #define endl '\n' #define pi pair<int, int> #define f first #define s second const int maxn = 1000; int n, m; int a[maxn][maxn]; queue<pi> q; void answer(){ cin >> n >> m; bool f = 0; if(n < m){ swap(n, m); f = 1; } for(int i = 0; i < n; i++){ if((m - 1) / 2) q.push({i, (m - 1) / 2}); } int ret = 0; memset(a, 0, sizeof(a)); for(int i = n / 2; !q.empty();i--){ pi p = q.front(); q.pop(); a[p.f][ret] = 1; if(--p.s) q.push(p); if(!i){ ret++; i = n / 2 + 1; } } ret += n; if(f) swap(n, m); cout << ret << endl; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cout << ((f ? a[j][i] : a[i][j]) ^ f ? '-' : '+'); } cout << endl; } } int main(){ ios::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; for(int i = 0; i < t; i++) answer(); return 0; }
#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...