# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1095597 | 2024-10-02T16:06:14 Z | peti1234 | Gardening (RMI21_gardening) | C++17 | 43 ms | 5724 KB |
#include <bits/stdc++.h> using namespace std; const int c=200005; vector<int> ans[c]; bool jo(int n, int m, int k) { int a=max(n, m)/2, b=n*m/4; if (n%2 || m%2 || k<a || k>b || k==b-1 || (n==m && k==a+1)) return false; return true; } void rec(int n1, int n2, int m1, int m2, int k) { int n=n2-n1+1, m=m2-m1+1; if (n==0 || m==0) { return; } if (jo(n-2, m-2, k-1)) { for (int i=n1; i<=n2; i++) { ans[i][m1]=k, ans[i][m2]=k; } for (int i=m1; i<=m2; i++) { ans[n1][i]=k, ans[n2][i]=k; } return rec(n1+1, n2-1, m1+1, m2-1, k-1); } if (jo(n-2, m, k-(m/2))) { for (int i=m1; i<=m2; i+=2) { ans[n1][i]=ans[n1][i+1]=ans[n1+1][i]=ans[n1+1][i+1]=k; k--; } return rec(n1+2, n2, m1, m2, k); } if (jo(n, m-2, k-(n/2))) { for (int i=n1; i<=n2; i+=2) { ans[i][m1]=ans[i+1][m1]=ans[i][m1+1]=ans[i+1][m1+1]=k; k--; } return rec(n1, n2, m1+2, m2, k); } } void solve() { int n, m, k; cin >> n >> m >> k; if (!jo(n, m, k)) { cout << "NO\n"; return; } for (int i=1; i<=n; i++) { ans[i].resize(m+1); } rec(1, n, 1, m, k); cout << "YES\n"; for (int i=1; i<=n; i++) { for (int j=1; j<=m; j++) { cout << ans[i][j] << " "; } cout << "\n"; } } int main() { ios_base::sync_with_stdio(false); int w; cin >> w; while (w--) { solve(); } }
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 5708 KB | Correct! Azusa and Laika like the garden :) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 5708 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 12 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 13 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 5708 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 12 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 13 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
4 | Correct | 11 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
5 | Correct | 11 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 8 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 7 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
4 | Correct | 8 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
5 | Correct | 9 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
6 | Correct | 8 ms | 5408 KB | Correct! Azusa and Laika like the garden :) |
7 | Correct | 9 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
8 | Correct | 8 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
9 | Correct | 9 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
10 | Correct | 9 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
11 | Correct | 8 ms | 5412 KB | Correct! Azusa and Laika like the garden :) |
12 | Correct | 7 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
13 | Correct | 7 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 4 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 4 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
4 | Correct | 5 ms | 5156 KB | Correct! Azusa and Laika like the garden :) |
5 | Correct | 5 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
6 | Correct | 5 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
7 | Correct | 5 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
8 | Correct | 5 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
9 | Correct | 5 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
10 | Correct | 4 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
11 | Correct | 4 ms | 5040 KB | Correct! Azusa and Laika like the garden :) |
12 | Correct | 4 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
13 | Correct | 4 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
14 | Correct | 5 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
15 | Correct | 4 ms | 5164 KB | Correct! Azusa and Laika like the garden :) |
16 | Correct | 4 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
17 | Correct | 5 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 5708 KB | Correct! Azusa and Laika like the garden :) |
2 | Correct | 12 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
3 | Correct | 13 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
4 | Correct | 11 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
5 | Correct | 11 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
6 | Correct | 12 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
7 | Correct | 8 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
8 | Correct | 7 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
9 | Correct | 8 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
10 | Correct | 9 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
11 | Correct | 8 ms | 5408 KB | Correct! Azusa and Laika like the garden :) |
12 | Correct | 9 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
13 | Correct | 8 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
14 | Correct | 9 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
15 | Correct | 9 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
16 | Correct | 8 ms | 5412 KB | Correct! Azusa and Laika like the garden :) |
17 | Correct | 7 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
18 | Correct | 7 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
19 | Correct | 4 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
20 | Correct | 4 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
21 | Correct | 4 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
22 | Correct | 5 ms | 5156 KB | Correct! Azusa and Laika like the garden :) |
23 | Correct | 5 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
24 | Correct | 5 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
25 | Correct | 5 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
26 | Correct | 5 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
27 | Correct | 5 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
28 | Correct | 4 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
29 | Correct | 4 ms | 5040 KB | Correct! Azusa and Laika like the garden :) |
30 | Correct | 4 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
31 | Correct | 4 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
32 | Correct | 5 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
33 | Correct | 4 ms | 5164 KB | Correct! Azusa and Laika like the garden :) |
34 | Correct | 4 ms | 5208 KB | Correct! Azusa and Laika like the garden :) |
35 | Correct | 5 ms | 5212 KB | Correct! Azusa and Laika like the garden :) |
36 | Correct | 10 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
37 | Correct | 10 ms | 5720 KB | Correct! Azusa and Laika like the garden :) |
38 | Correct | 10 ms | 5720 KB | Correct! Azusa and Laika like the garden :) |
39 | Correct | 10 ms | 5724 KB | Correct! Azusa and Laika like the garden :) |
40 | Correct | 11 ms | 5664 KB | Correct! Azusa and Laika like the garden :) |
41 | Correct | 10 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
42 | Correct | 9 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
43 | Correct | 10 ms | 5636 KB | Correct! Azusa and Laika like the garden :) |
44 | Correct | 10 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
45 | Correct | 9 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
46 | Correct | 10 ms | 5724 KB | Correct! Azusa and Laika like the garden :) |
47 | Correct | 10 ms | 5664 KB | Correct! Azusa and Laika like the garden :) |
48 | Correct | 10 ms | 5724 KB | Correct! Azusa and Laika like the garden :) |
49 | Correct | 11 ms | 5720 KB | Correct! Azusa and Laika like the garden :) |
50 | Correct | 10 ms | 5648 KB | Correct! Azusa and Laika like the garden :) |
51 | Correct | 9 ms | 5464 KB | Correct! Azusa and Laika like the garden :) |
52 | Correct | 14 ms | 5724 KB | Correct! Azusa and Laika like the garden :) |
53 | Correct | 10 ms | 5724 KB | Correct! Azusa and Laika like the garden :) |
54 | Correct | 10 ms | 5720 KB | Correct! Azusa and Laika like the garden :) |
55 | Correct | 9 ms | 5468 KB | Correct! Azusa and Laika like the garden :) |
56 | Correct | 13 ms | 5720 KB | Correct! Azusa and Laika like the garden :) |
57 | Correct | 10 ms | 5724 KB | Correct! Azusa and Laika like the garden :) |
58 | Correct | 10 ms | 5724 KB | Correct! Azusa and Laika like the garden :) |
59 | Correct | 14 ms | 5676 KB | Correct! Azusa and Laika like the garden :) |
60 | Correct | 18 ms | 5720 KB | Correct! Azusa and Laika like the garden :) |