Submission #742831

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7428312023-05-17 03:43:54hmm789Gardening (RMI21_gardening)C++14
39 / 100
21 ms724 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
vector<vector<int>> a;
int clr = 1;
void solve(int l, int r, int u, int d, int k) {
int n = d-u+1, m = r-l+1;
if(n <= 0 || m <= 0) return;
if(k == n*m/4) {
for(int i = u; i <= d; i++) {
for(int j = l; j <= r; j++) {
if((i-u)%2==0) {
if((j-l)%2==0) a[i][j] = clr;
else a[i][j] = clr++;
} else a[i][j] = a[i-1][j];
}
}
} else if(k >= n*m/4-n/2-m/2+2) {
int num = n*m/4-k;
if(num*2 <= m) {
for(int i = l; i < l+num*2; i++) a[u][i] = a[min(d, u+3)][i] = clr;
for(int i = u; i <= min(d, u+3); i++) a[i][l] = a[i][l+num*2-1] = clr;
clr++;
solve(l+1, l+num*2-2, u+1, min(d, u+3)-1, num-1);
solve(l+num*2, r, u, min(d, u+3), r-(l+num*2)+1);
solve(l, r, min(d, u+3)+1, d, k-1-(num-1)-(r-(l+num*2)+1));
} else {
int cols = (num-m/2)*2+4;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...