QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#468921 | #7180. Forward-Capturing Pawns | embusca# | WA | 32ms | 3832kb | C++20 | 1.3kb | 2024-07-09 04:00:11 | 2024-07-09 04:00:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rp(i,a,b) for(int i=a;i<b;i++)
void solvetask(){
string wk, wp, bk, v;
cin >> wk >> wp >> bk >> v;
if((v[0] == 'w' && wp[1] > bk[1]) || (v[0] == 'b' && wp[1] > bk[1]+1)){
cout << "Win\n";
return;
}
int wd = max(abs((wk[0]-'a') - (wp[0]-'a')), abs((wk[1]-'0') - (wp[1]-'0'))), bd = max(abs((bk[0]-'a') - (wp[0]-'a')), abs((bk[1]-'0') - (wp[1]-'0'))), dp = '8'-wp[1];
if(v[0] == 'b') bd--;
if((bk == "h8" && wp == "g7" && ((wk == "g6") || (wk == "h6"))) && v == "b"){
cout << "Draw\n";
return;
}
if((bk == "a8" && wp == "b7" && ((wk == "b6") || (wk == "a6")) || bd <= 1) && v == "b"){
cout << "Draw\n";
return;
}
if(bd < wd-1 && bd <= dp){
if(wp[1] == '2'){
wp[1] = '4';
wd = max(abs((wk[0]-'a') - (wp[0]-'a')), abs((wk[1]-'0') - (wp[1]-'0'))), bd = max(abs((bk[0]-'a') - (wp[0]-'a')), abs((bk[1]-'0') - (wp[1]-'0'))), dp = '8'-wp[1];
if(v[0] == 'b') bd--;
}
if(bd < wd-1 && bd <= dp) cout << "Draw\n";
else cout << "Win\n";
}
else cout << "Win\n";
}
int main(){
cin.tie(0)->sync_with_stdio(0);
ll t = 1;
cin >> t;
while(t--) solvetask();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3520kb
input:
6 a2 d7 e7 w b6 d7 e7 b b6 d7 e7 w b5 a2 b2 w a6 a2 a4 b g6 g7 h8 b
output:
Draw Draw Win Win Draw Draw
result:
ok 6 lines
Test #2:
score: -100
Wrong Answer
time: 32ms
memory: 3832kb
input:
332912 h8 h7 f8 b h8 h7 f8 w h8 h7 e8 b h8 h7 e8 w h8 h7 d8 b h8 h7 d8 w h8 h7 c8 b h8 h7 c8 w h8 h7 b8 b h8 h7 b8 w h8 h7 a8 b h8 h7 a8 w h8 h7 f7 b h8 h7 f7 w h8 h7 e7 b h8 h7 e7 w h8 h7 d7 b h8 h7 d7 w h8 h7 c7 b h8 h7 c7 w h8 h7 b7 b h8 h7 b7 w h8 h7 a7 b h8 h7 a7 w h8 h7 h6 b h8 h7 h6 w h8 h7 g...
output:
Draw Win Win Win Win Win Win Win Win Win Win Win Draw Win Win Win Win Win Win Win Win Win Win Win Draw Win Draw Win Draw Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win Win...
result:
wrong answer 2nd lines differ - expected: 'Draw', found: 'Win'