Submission #1338783
Source Code Expand
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;
int H, W, N, X[11], Y[11];
std::vector<std::pair<int, int>>ans;
bool ok(int x1, int y1, int x2, int y2)
{
rep(i, N)
{
int x = X[i], y = Y[i];
int d;
if (x1 > x2) {
d = x1, x1 = x2, x2 = d;
d = y1, y1 = y2, y2 = d;
}
return (x1 <= x && x <= x2 &&
((y1 <= y2 && y1 <= y && y <= y2) ||
(y1 > y2 && y2 <= y && y <= y1))
&& (y - y1)*(x2 - x1) == (y2 - y1)*(x - x1) == 1 ? true : false);
}
}
int main()
{
in >> H >> W >> N;
rep(i, N) { in >> X[i] >> Y[i]; }
for (int x = 1; x <= H; ++x)
{
if (ok(0, 0, x, W)) { ans.push_back({ x,W }); }
}
for (int y = 1; y <= W; ++y)
{
if (ok(0, 0, H, y)) { ans.push_back({ H,y }); }
}
for (auto i : ans) { out << '(' << i.first << ',' << i.second << ')' << std::endl; }
return 0;
}
Submission Info
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 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 |
WA |
1 ms |
256 KB |
in2.txt |
WA |
1 ms |
256 KB |
in3.txt |
WA |
1 ms |
256 KB |
in4.txt |
WA |
1 ms |
256 KB |
in5.txt |
WA |
1 ms |
256 KB |
in6.txt |
WA |
1 ms |
256 KB |
in7.txt |
WA |
1 ms |
256 KB |
in8.txt |
WA |
1 ms |
256 KB |
sample1.txt |
WA |
1 ms |
256 KB |
sample2.txt |
WA |
1 ms |
256 KB |
sample3.txt |
WA |
1 ms |
256 KB |