Submission #1211583

#TimeUsernameProblemLanguageResultExecution timeMemory
1211583Sir_Ahmed_ImranGardening (RMI21_gardening)C++17
5 / 100
15 ms832 KiB
// 01001100 01001111 01010100 01000001 \\ // \\ // ╦ ╔═╗╔╦╗╔═╗ \\ // ║ ║ ║ ║ ╠═╣ \\ // ╩═╝╚═╝ ╩ ╩ ╩ \\ // \\ // 01001100 01001111 01010100 01000001 \\ #include <bits/stdc++.h> using namespace std; #define N 500 #define nl '\n' #define ff first #define ss second #define add insert #define ll long long #define ld long double #define terminator main #define pll pair<ll,ll> #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) void solve(){ int x, y, z; ll n, m, k, mx; cin >> n >> m >> k; mx = (n / 2) * (m / 2); if(n % 2 || m % 2 || (mx + k) % 2 || k > mx){ cout << "NO\n"; return; } map<int, map<int, int>> a; x = y = z = 1; for(int t = n; t > 2; t -= 2){ if(mx - t + 2 >= k){ mx -= t - 2; for(int i = z; i < z + t; i++) a[i][z] = a[z][i] = a[z + t - 1][i] = a[i][z + t - 1] = z; z++; } } for(int i = 1; i < n; i++) for(int j = 1; j < m; j++) if(!a[i][j] && !a[i + 1][j] && !a[i][j + 1] && !a[i + 1][j + 1]) a[i][j] = a[i + 1][j] = a[i][j + 1] = a[i + 1][j + 1] = z, z++; if(z != k + 1){ cout << "NO\n"; return; } cout << "YES\n"; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ cout << a[i][j] << ' '; } cout << nl; } } int terminator(){ L0TA; int T; cin >> T; while(T--) solve(); 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...