Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define NMAX 103
- int n, m;
- int inc[NMAX][NMAX], d[NMAX][2];
- 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 <= n; j++) {
- for (int i = 1; i <= m; i++) {
- if (inc[i][j] == 1) {
- d[i][0]++;
- }
- if (inc[i][j] == -1) {
- d[i][1]++;
- }
- }
- }
- }
- void write() {
- cout << "1: ";
- for (int j = 1; j <= n; j++) {
- if (!d[j][1] && !d[j][0]) {
- cout << j << ' ';
- }
- }
- cout << endl << "2: ";
- for (int j = 1; j <= n; j++) {
- if (d[j][1] > d[j][0]) {
- cout << j << ' ';
- }
- }
- }
- int main() {
- read();
- solve();
- write();
- return 0;
- }
Add Comment
Please, Sign In to add comment