Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
File size: 561 Bytes
d3f4f72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
using namespace std;

int N, M, A, B;

void solve() {
  cin >> N >> M >> A >> B;
  A -= N + M - 2;
  B -= N + M - 2;
  if (A < 1 || B < 1) {
    cout << "Impossible" << endl;
    return;
  }
  cout << "Possible" << endl;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      int ans = (!i && !j) ? A : (!i && j == M - 1) ? B : 1;
      cout << ans << (j < M - 1 ? ' ' : '\n');
    }
  }
}

int main() {
  int T;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    cout << "Case #" << t << ": ";
    solve();
  }
  return 0;
}