| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1367280 | biserailieva | Superpiece (EGOI22_superpiece) | C++20 | 2 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int q;
cin>>q;
while(q--)
{
string s;
cin>>s;
long long a, b, c, d;
cin>>a>>b>>c>>d;
if(s[0]=='Q')
{
if(s.find('N')!=string::npos)
{
if(a==c && b==d)
{
cout<<0<<endl;
}
else if((c==a+1 && d==b+2) ||
(c==a+1 && d==b-2) ||
(c==a+2 && d==b+1) ||
(c==a+2 && d==b-1) ||
(c==a-2 && d==b+1) ||
(c==a-2 && d==b-1) ||
(c==a-1 && d==b+2) ||
(c==a-1 && d==b-2))
{
cout<<1<<endl;
}
}
else
{
if(a==c && b==d)
{
cout<<0<<endl;
}
else if(a==c || b==d || abs(a-c)==abs(b-d))
{
cout<<1<<endl;
}
else
{
cout<<2<<endl;
}
}
}
if(s=="P")
{
if(b!=d || a>c)
{
cout<<-1<<endl;
}
else
{
cout<<c-a<<endl;
}
}
else if(s=="KP" || s=="K")
{
cout<<max(abs(a-c), abs(b-d))<<endl;
}
else if(s=="B")
{
if(a==c && b==d)
{
cout<<0<<endl;
}
else if(abs((a+b)%2)!=abs((c+d)%2))
{
cout<<-1<<endl;
}
else if((a-c==b-d) || (a-c==d-b))
{
cout<<1<<endl;
}
else
{
cout<<2<<endl;
}
}
else if(s[0]=='B')
{
}
}
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
