QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#468920#7180. Forward-Capturing Pawnsembusca#WA 0ms3612kbC++201.3kb2024-07-09 03:59:142024-07-09 03:59:14

Judging History

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

  • [2024-07-09 03:59:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-07-09 03:59:14]
  • 提交

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();
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3612kb

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:

Win
Draw
Win
Win
Draw
Draw

result:

wrong answer 1st lines differ - expected: 'Draw', found: 'Win'