#include #include #include using namespace std; const int MAXS = 10000; const int MAXNM = 100; bool repeated(int x[], int y[], int n) { for(int i=0; i> r >> c >> n >> m; if (r < 1 || r > MAXS) { cout << "ERROR: incorrect number rows: " << r << endl; return 1;} if (c < 1 || c > MAXS) { cout << "ERROR: incorrect number columns: " << c << endl; return 2;} if (n < 0 || m < 0 || n+m > MAXNM) { cout << "ERROR: n, m: " << n << ',' << m << endl; return 3;} for(int i=0; i> x[i] >> y[i]; if (x[i] < 0 || x[i] >= r) { cout << "ERROR: invalid row value for icon "<< i << ": " << x[i] << endl; return 4;} if (y[i] < 0 || y[i] >= c) { cout << "ERROR: invalid col value for icon "<< i << ": " << x[i] << endl; return 5;} if (repeated(x, y, i)) { cout << "ERROR: repeated icon position "<< i << ": " << x[i] << ',' << y[i] << endl; return 6;} } return 42; }