QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#325220#5614. Simple Solitaireaggrovector#WA 0ms3596kbC++142.1kb2024-02-11 05:59:462024-02-11 05:59:46

Judging History

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

  • [2024-02-11 05:59:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2024-02-11 05:59:46]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
long long i,l,r,j;
string str;
vector<string> v;

int main() {
    for (i=1;i<=52;i++) {
        cin >> str;
        // cout << str << endl;
        v.push_back(str);
        // cout << "before remove: " << endl;
        // for (int j=0;j<v.size();j++) {
        //     cout << v[j] << ' ';
        // }
        // cout << endl;
        l=v.size()-1;
        if (v.size()>=4 && v[l][0]==v[l-3][0]) {
            v.erase(v.begin()+l-3,v.begin()+l+1);
            continue;
        }
        else if (v.size()>=4 && v[l][1]==v[l-3][1]) {
            v.erase(v.begin()+l-3,v.begin()+l-2);
            v.erase(v.begin()+l-1,v.begin()+l);
        }
        // cout << "first remove: " << endl;
        // for (int j=0;j<v.size();j++) {
        //     cout << v[j] << ' ';
        // }
        // cout << endl;
        l=v.size()-2;
        r=l+1;
        while(1) {
            if (r-3>=0 && v[r][0]==v[r-3][0]) {
                v.erase(v.begin()+r-3,v.begin()+r+1);
                break;
            }
            else if (l-3>=0 && v[l][0]==v[l-3][0]) {
                v.erase(v.begin()+l-3,v.begin()+l+1);
                break;
            }
            else if (r-3>=0 && v[r][1]==v[r-3][1]) {
                v.erase(v.begin()+r-3,v.begin()+r-2);
                v.erase(v.begin()+r-1,v.begin()+r);
                l=r-3;
                r=l+1;
            }
            else if (l-3>=0 && v[l][1]==v[l-3][1]) {
                v.erase(v.begin()+l-3,v.begin()+l-2);
                v.erase(v.begin()+l-1,v.begin()+l);
                l=l-3;
                r=l+1;
            }
            else {
                break;
            }
        }
        // cout << "hand: " << endl;
        // for (int j=0;j<v.size();j++) {
        //     cout << v[j] << ' ';
        // }
        // cout << endl;
    }
    cout << v.size() << ' ';
    for (i=0;i<4;i++) {
        for (j=0;j<13;j++) {
            if (i*13+j<v.size()) {
                cout << v[i*13+j] << ' ';
            }
        }
        cout << endl;
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3596kb

input:

TC 2C 6C TS KC QS QC 3C KD 8D JH JS KH
5D JD 2S 8S AS 9S 3D 5H 9C AH 4D 4C KS
JC 4S 7S 6D 2H 7C 8C 7D AD 7H TH 2D QH
8H 9H 5C TD 3S 6H 3H QD 5S 9D 4H 6S AC

output:

2 3S 9D 




result:

ok single line: '2 3S 9D '

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3580kb

input:

TH 2C 8H AS JH JS TS QC KS 3S JC 4D AH
QS 2S 5S 3D 7C 4H AD 5C 7S 6C 6S 9C 5D
8D 9H 7H 3H KD KH 4C 8S QD 2D 8C QH KC
TC 2H 4S 6H 5H 3C TD 6D JD AC 9S 7D 9D

output:

2 4S 6D 




result:

wrong answer 1st lines differ - expected: '6 KC 4S 6H TD AC 9S', found: '2 4S 6D '