#include #include #include #include #include #include #include #include "validate.h" using namespace std; int main(int argc, char **argv) { init_io(argc, argv); int n; int m; judge_in >> n >> m; vector a; vector b; vector c; vector d; for (int i = 0; i < n; ++i) { int ai, bi, ci, di; author_out >> ai >> bi >> ci >> di; if (ai <= 0) { wrong_answer("a_%d is not positive", i + 1); } if (bi <= 0) { wrong_answer("b_%d is not positive", i + 1); } if (ci <= 0) { wrong_answer("c_%d is not positive", i + 1); } if (di <= 0) { wrong_answer("d_%d is not positive", i + 1); } // ai / bi shoudl be less than 1 if (ai > bi) { wrong_answer("a_%d > b_%d", i + 1, i + 1); } // ci / di shoudl be less than 1 if (ci > di) { wrong_answer("c_%d > d_%d", i + 1, i + 1); } a.push_back(ai); b.push_back(bi); c.push_back(ci); d.push_back(di); } if (std::accumulate(b.begin(), b.end(), 0) != m) { wrong_answer("Sum of b_i != M"); } if (std::accumulate(d.begin(), d.end(), 0) != m) { wrong_answer("Sum of d_i != M"); } for (int i = 0; i < n; ++i) { // assert(a[i] / b[i] > c[i] / d[i]); if (!((long long) (a[i]) * d[i] > (long long) (c[i]) * b[i])) { wrong_answer("a[i] / b[i] > c[i] / d[i] is not true for i = %d", i + 1); } } if (!(std::accumulate(a.begin(), a.end(), 0) < std::accumulate(c.begin(), c.end(), 0))) { wrong_answer("sum of a_i >= sum of c_i"); } accept(); }