QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#701516#5260. The GameWedonotLikeStudyingWA 0ms3668kbC++232.9kb2024-11-02 14:18:052024-11-02 14:18:10

Judging History

This is the latest submission verdict.

  • [2024-11-02 14:18:10]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3668kb
  • [2024-11-02 14:18:05]
  • Submitted

answer

#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i,j,k) for (int i=(j);i<=(k);++i)
#define dep(i,j,k) for (int i=(j);i>=(k);--i)
using namespace std;

int pile[100],cnt;
int cnta1,cnta2,cntd1,cntd2;
int lsta1[100],lsta2[100],lstd1[100],lstd2[100];

list <int> hand;

void getCard(int x) {
    while (x--) {
        hand.emplace_back(pile[++cnt]);
    }
}

void throwCard(int i) {
    for (auto it=hand.begin();it!=hand.end();++it) {
        if ((*it)==i) {
            hand.erase(it);
            break;
        }
    }
    // cout<<i<<"\n";
}

bool checkTrick(int x) {
    if (x==lsta1[cnta1]-10) {
        lsta1[++cnta1]=x;
        return true;
    } else if(x==lsta2[cnta2]-10) {
        lsta2[++cnta2]=x;
        return true;
    } else if (x==lstd1[cntd1]+10) {
        lstd1[++cntd1]=x;
        return true;
    } else if (x==lstd2[cntd2]+10) {
        lstd2[++cntd2]=x;
        return true;
    } else return false;
}

int getMin(int x) {
    int ans=INF;
    if (x>lsta1[cnta1]) {
        ans=min(ans,x-lsta1[cnta1]);
    }
    if (x>lsta2[cnta2]) {
        ans=min(ans,x-lsta2[cnta2]);
    }
    if (x<lstd1[cntd1]) {
        ans=min(ans,lstd1[cntd1]-x);
    }
    if (x<lstd2[cntd2]) {
        ans=min(ans,lstd2[cntd2]-x);
    }
    return ans;
}

bool checkMin(int x,int Min) {
    if (x-lsta1[cnta1]==Min) {
        lsta1[++cnta1]=x;
        return true;
    } else if (x-lsta2[cnta2]==Min) {
        lsta2[++cnta2]=x;
        return true;
    } else if (lstd1[cntd1]-x==Min) {
        lstd1[++cntd1]=x;
        return true;
    } else if (lstd2[cntd2]-x==Min) {
        lstd2[++cntd2]=x;
        return true;
    } else return false;
}

int main() {
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    rep(i,1,98) cin>>pile[i];
    getCard(8);
    lsta1[0]=lsta2[0]=1;
    lstd1[0]=lstd2[0]=100;
    rep(q,1,98) {
        if (hand.size()==6&&cnt<98) getCard(2);
        int flag=0;
        for (auto i:hand) {
            if (checkTrick(i)) {
                throwCard(i);
                flag=1;
                break;
            }
        }
        if (flag) continue;
        int Min=INF;
        for (auto i:hand) {
            Min=min(Min,getMin(i));
        }
        // cout<<Min<<"\n";
        // cout<<getMin(96)<<"\n";
        if (Min==INF) {
            break;
        }
        for (auto i:hand) {
            if (checkMin(i,Min)) {
                throwCard(i);
                break;
            }
        }
    }
    rep(i,0,cnta1) cout<<lsta1[i]<<" "[i==cnta1];
    cout<<"\n";
    rep(i,0,cnta2) cout<<lsta2[i]<<" "[i==cnta2];
    cout<<"\n";
    rep(i,0,cntd1) cout<<lstd1[i]<<" "[i==cntd1];
    cout<<"\n";
    rep(i,0,cntd2) cout<<lstd2[i]<<" "[i==cntd2];
    cout<<"\n";
    if (!hand.empty()) {
        for (auto i:hand) cout<<i<<" ";
        cout<<"\n";
    }
    if (cnt<98) rep(i,cnt+1,98) cout<<pile[i]<<" ";
    cout<<"\n";
    return 0;
}

詳細信息

Test #1:

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

input:

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

result:

wrong answer 1st lines differ - expected: '1 2 3 4 5 6 7 8 9 10 11 12 13 ...9 90 91 92 93 94 95 96 97 98 99', found: '1 2 3 4 5 6 7 8 9 10 11 12 13 ... 90 91 92 93 94 95 96 97 98 99'