이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int m, n;
int queendiagonal(int x, int y)
{
if (y<x)
swap(x, y);
if ((m+y-x-1)%2==1)
return 0;
int a=(m+y-x-1)/2;
int b=m-1-a;
if (x+a<=n && x-b>=1)
return 2;
if (x+a<=n || x-b>=1)
return 1;
return 0;
}
int main()
{
int q, x, y;
char type;
cin >> m >> n >> q;
while (q--)
{
cin >> type >> x >> y;
if (type=='P')
{
if (x==y)
cout << 1 << " " << 1 << '\n';
else
cout << 0 << " " << 0 << '\n';
}
if (type=='R')
{
if (x==y)
cout << 1 << " " << 1 << '\n';
else
cout << 2 << " " << 2 << '\n';
}
if (type=='Q')
{
if (x==y)
cout << 1 << " " << 1 << '\n';
else
cout << 2 << " " << 4+queendiagonal(x, y) << '\n';
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |