Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define NMAX 103
- int n, m;
- bool a[NMAX][NMAX];
- int inc[NMAX][NMAX];
- void read() {
- cin >> n >> m;
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j <= m; j++) {
- cin >> inc[i][j];
- }
- }
- }
- void solve() {
- for (int j = 1; j <= m; j++) {
- int x, y;
- for (int i = 1; i <= n; i++) {
- if (inc[i][j] == 1) {
- x = i;
- }
- if (inc[i][j] == -1) {
- y = i;
- }
- }
- a[x][y] = true;
- }
- }
- void write() {
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j <= n; j++) {
- cout << a[i][j] << ' ';
- }
- cout << endl;
- }
- }
- int main() {
- read();
- solve();
- write();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement