QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#468907#7180. Forward-Capturing Pawnsembusca#WA 28ms3564kbC++201.3kb2024-07-09 02:44:272024-07-09 02:44:28

Judging History

你现在查看的是最新测评结果

  • [2024-07-09 02:44:28]
  • 评测
  • 测评结果:WA
  • 用时:28ms
  • 内存:3564kb
  • [2024-07-09 02:44:27]
  • 提交

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')));
    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){
        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')));
            if(v[0] == 'b') bd--;
        }
        if(bd < wd-1) 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: 3508kb

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: 28ms
memory: 3564kb

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'