QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#325230 | #5614. Simple Solitaire | aggrovector# | WA | 1ms | 3784kb | C++14 | 2.0kb | 2024-02-11 06:07:14 | 2024-02-11 06:07:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
long long i,l,r,j;
string str;
vector<string> v;
bool flag;
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 (l-3>=0 && v[l][0]==v[l-3][0]) {
v.erase(v.begin()+l-3,v.begin()+l+1);
continue;
}
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);
}
// cout << "first remove: " << endl;
// for (int j=0;j<v.size();j++) {
// cout << v[j] << ' ';
// }
// cout << endl;
while(1) {
flag=false;
for (r=v.size()-1;r>=0;r--) {
if (r-3>=0 && v[r][0]==v[r-3][0]) {
v.erase(v.begin()+r-3,v.begin()+r+1);
flag=true;
break;
}
}
if (flag) {
continue;
}
for (r=v.size()-1;r>=0;r--) {
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);
flag=true;
break;
}
}
if (!flag) {
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;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3748kb
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: 0
Accepted
time: 0ms
memory: 3504kb
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:
6 KC 4S 6H TD AC 9S
result:
ok single line: '6 KC 4S 6H TD AC 9S '
Test #3:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
3H 8D 9H 4S 7H KC 6H 4D 4H 5H TS 2C JH QD QH 6C TD KD 3S KS TC 8S KH 2D 9D 9C QS 7D JS 5C 2H AS 5S 5D 4C 7C 8C AC 3C 6D 7S 8H AD 3D JC 2S 6S QC TH JD AH 9S
output:
12 TS AS 5S 5D 7C 3D 2S 6S TH JD AH 9S
result:
ok single line: '12 TS AS 5S 5D 7C 3D 2S 6S TH JD AH 9S '
Test #4:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
9C 2S 5H KS 3S QH 5D 6C JD TC 6H 7C 8H AS 8S 8C 3D JS 2C KD 4C JH AH 5S 4S JC 2D 9S QS QD KH 3H 5C 7H 7D 7S KC 4D 3C 9D 4H AD TH 9H 2H AC QC 6S TD 8D TS 6D
output:
10 KC 9D TH 9H 2H AC QC TD 8D 6D
result:
ok single line: '10 KC 9D TH 9H 2H AC QC TD 8D 6D '
Test #5:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
QS 6D 4H 3H 7S 2S 3C 4D 5H 7H KS 8S 8D 4S 3S KD 3D 2D 6C 4C 7D QH KH JH 2C 6S 6H QC 5D 7C 8H 2H AC JC TH TC JS TD 8C TS 5C 5S AS 9C 9D QD JD AD 9H 9S AH KC
output:
4 2H 5C QD JD
result:
ok single line: '4 2H 5C QD JD '
Test #6:
score: 0
Accepted
time: 1ms
memory: 3476kb
input:
AH AS AC AD 2H 2S 2C 2D 3H 3S 3C 3D 4H 4S 4C 4D 5H 5S 5C 5D 6H 6S 6C 6D 7H 7S 7C 7D 8H 8S 8C 8D 9H 9S 9C 9D TH TS TC TD JH JS JC JD QH QS QC QD KH KS KC KD
output:
0
result:
ok single line: '0 '
Test #7:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
AH 2H 3H 4H 5H 6H 7H 8H 9H TH JH QH KH AS 2S 3S 4S 5S 6S 7S 8S 9S TS JS QS KS AC 2C 3C 4C 5C 6C 7C 8C 9C TC JC QC KC AD 2D 3D 4D 5D 6D 7D 8D 9D TD JD QD KD
output:
2 JC QC
result:
ok single line: '2 JC QC '
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3540kb
input:
AH 2C 3D 4S 5H 6C 7D 8S 9H TC JD QS KH AC 2D 3S 4H 5C 6D 7S 8H 9C TD JS QH KC AD 2S 3H 4C 5D 6S 7H 8C 9D TS JH QC KD AS 2H 3C 4D 5S 6H 7C 8D 9S TH JC QD KS
output:
52 AH 2C 3D 4S 5H 6C 7D 8S 9H TC JD QS KH AC 2D 3S 4H 5C 6D 7S 8H 9C TD JS QH KC AD 2S 3H 4C 5D 6S 7H 8C 9D TS JH QC KD AS 2H 3C 4D 5S 6H 7C 8D 9S TH JC QD KS
result:
wrong answer 1st lines differ - expected: '52 AH 2C 3D 4S 5H 6C 7D 8S 9H ...C 4D 5S 6H 7C 8D 9S TH JC QD KS', found: '52 AH 2C 3D 4S 5H 6C 7D 8S 9H TC JD QS KH '