Submission #1274220
Source Code Expand
// clang-format off
#include <bits/stdc++.h>
#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))
#define sum(v) accumulate(all(v), 0)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))
#define INF 1000000000
#define MOD 1000000007
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using namespace std;
// clang-format on
int n;
int x[10], y[10];
bool f(int a, int b) {
int l = 0, r = 0;
rep(i, n) {
if (a * y[i] > b * x[i]) {
l++;
} else if (a * y[i] < b * x[i]) {
r++;
} else {
return false;
}
}
return l == r;
}
main {
int h, w;
cin >> h >> w >> n;
if (odd(n)) {
cout << -1 << endl;
bye;
}
rep(i, n) cin >> x[i] >> y[i];
bool t = true;
loop(i, 1, w) if (f(i, h)) {
t = false;
cout << '(' << i << ',' << h << ')' << endl;
}
loop(i, 1, h + 1) if (f(w, i)) {
t = false;
cout << '(' << w << ',' << i << ')' << endl;
}
if (t) {
cout << -1 << endl;
}
bye;
}
Submission Info
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
100 / 100 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample1.txt, sample2.txt, sample3.txt |
All |
in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name |
Status |
Exec Time |
Memory |
in1.txt |
AC |
1 ms |
256 KB |
in2.txt |
AC |
1 ms |
256 KB |
in3.txt |
AC |
1 ms |
256 KB |
in4.txt |
AC |
1 ms |
256 KB |
in5.txt |
AC |
1 ms |
256 KB |
in6.txt |
AC |
1 ms |
256 KB |
in7.txt |
AC |
1 ms |
256 KB |
in8.txt |
AC |
1 ms |
256 KB |
sample1.txt |
AC |
1 ms |
256 KB |
sample2.txt |
AC |
1 ms |
256 KB |
sample3.txt |
AC |
1 ms |
256 KB |