QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#325280 | #5614. Simple Solitaire | aggrovector# | AC ✓ | 0ms | 3852kb | C++14 | 2.0kb | 2024-02-11 07:10:11 | 2024-02-11 07:10:12 |
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));
}
else if (l-3>=0 && v[l][1]==v[l-3][1]) {
v.erase(v.begin()+l,v.begin()+l+1);
v.erase(v.begin()+(l-3),v.begin()+(l-2));
}
// 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,v.begin()+(r+1));
v.erase(v.begin()+(r-3),v.begin()+(r-2));
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;
// }
for (auto thing : v) {
cout << thing << ' ';
}
cout << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3812kb
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: 3544kb
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: 3600kb
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: 3640kb
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: 3612kb
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: 0ms
memory: 3776kb
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: 3588kb
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: 0
Accepted
time: 0ms
memory: 3608kb
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:
ok single line: '52 AH 2C 3D 4S 5H 6C 7D 8S 9H ... 4D 5S 6H 7C 8D 9S TH JC QD KS '
Test #9:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
AS 2S 3S 4H 5H 6H 7C 8C 9C TD JD QD KS 4S 5S 7H 8H 9H TC JC QC KD AD 2D 6S 7S 8S TH JH QH KC AC 2C 3D 4D 5D 9S TS JS KH AH 2H 3C 4C 5C 6D 7D 8D QS 3H 6C 9D
output:
52 AS 2S 3S 4H 5H 6H 7C 8C 9C TD JD QD KS 4S 5S 7H 8H 9H TC JC QC KD AD 2D 6S 7S 8S TH JH QH KC AC 2C 3D 4D 5D 9S TS JS KH AH 2H 3C 4C 5C 6D 7D 8D QS 3H 6C 9D
result:
ok single line: '52 AS 2S 3S 4H 5H 6H 7C 8C 9C ... 3C 4C 5C 6D 7D 8D QS 3H 6C 9D '
Test #10:
score: 0
Accepted
time: 0ms
memory: 3616kb
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 QD JC KS
output:
36 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 QC 4D KS
result:
ok single line: '36 AH 2C 3D 4S 5H 6C 7D 8S 9H ... AD 2S 3H 4C 5D 6S 7H QC 4D KS '
Test #11:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
7D AH AD QS 2C TD 4D 6H JD JH KD 4H 2D 7H KC 8H JS 4C 9C 9H 6D 3H AC 2S TH QD 3S KS 7C 8S 5C 2H 5D QC 9D 9S 5H TS QH 6C 4S 8C KH 3C 5S 6S 7S 8D JC AS 3D TC
output:
16 7D KS 5C QC 9D 9S 5H 6C 8C 3C 5S 6S 8D JC 3D TC
result:
ok single line: '16 7D KS 5C QC 9D 9S 5H 6C 8C 3C 5S 6S 8D JC 3D TC '
Test #12:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
6S 3S KC JD 5H AD 3C 9D 4S 2H 3D 9C TC TD QH KS 8D 4H 2D 8H QS 3H JH AC 2C 5D AH 2S 8C 7D 8S 9H 7C 6H 6C 5C JC TS 6D 7H 4C 7S QD QC KH 5S AS 9S KD 4D TH JS
output:
4 4C 4D TH JS
result:
ok single line: '4 4C 4D TH JS '
Test #13:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
QC 2C 8H 8C 7D 8S 5S TH 7H 9D 5H 4D 9H 6S QH 5C JD KH 3H 6H 6D 4S 3C 4H JH 9C 8D 7S JS TC KS QD TS AC 4C KD AD 3D 7C 2D 3S JC 2S AS 5D 9S KC 6C QS 2H AH TD
output:
4 6C QS AH TD
result:
ok single line: '4 6C QS AH TD '
Test #14:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
5S TD AD QS 9S 5H 7H 7C 5D 3S 8S 7D 4H AH 8H TS 2H JC 6H 5C JD TC 3H TH 6S QH 2S QC KC 4S KD 4D AC 6C 3C 7S AS 2C 9D JH KS KH 4C 8D QD 8C 6D 9C 3D 9H JS 2D
output:
6 8D 6D 9C 9H JS 2D
result:
ok single line: '6 8D 6D 9C 9H JS 2D '
Test #15:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
5D AC 4C 6C KS TH JH TS 4H 2C 3C QC 3H 3D 9S 6D AH 5S QS QH KC 2D TC KD 9C 7H TD 2H AD 8C 3S 9D 2S 6S 6H 8S 7S 4D 7D AS 9H JC 5H 7C JS KH 4S 8H JD 8D QD 5C
output:
4 KH JD QD 5C
result:
ok single line: '4 KH JD QD 5C '
Test #16:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
8H 3S QH KC TS 8D TH 5D 7C AS 4D 6H 4S JH 9S 6D 3H 6S AH 8C KD 3C 9C 7S 5S TD AD 5C 5H AC TC KS 7H 2H 9D 9H 4C 8S KH 4H 7D QC 3D JS 2C JD 6C QD JC 2D 2S QS
output:
4 TC KS 2D QS
result:
ok single line: '4 TC KS 2D QS '
Test #17:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
8S 6H 3S 7C TH 7H 4S 5H KC TD 5S 5C TC KS 9C AC QC JD AH 6C AD JS 8C 9S QH QD QS 9H 2S JH 2D 9D 3H AS 4C 8D 7S 3C 2H 8H 3D 6D KH 5D 4H 2C 6S 7D KD TS 4D JC
output:
4 7D KD 4D JC
result:
ok single line: '4 7D KD 4D JC '
Test #18:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
6C 9D 4C 8D TD 7C 2H 7H 6D JD 4D 8S 3S AC TC 9H 8H 5S QD 9S QH 2S 7S QC 5C 9C JH KC KD 4S AS 2C AH 4H 6S KH TH JS KS 5D 6H 7D 2D 5H TS 3H 8C JC AD 3D 3C QS
output:
4 2C JS 7D QS
result:
ok single line: '4 2C JS 7D QS '
Test #19:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
6S TH 2C AS AC JC 3C AD 3D TD 3S QH 8S 5C KH 9S 9H 4H 8D 8C 7D AH QD JS 2S KS 5S 6D 4D JD 5D 5H 6H TC JH 2D KC 4C KD 8H 7C QC QS 7H 3H 4S 2H 7S 6C TS 9C 9D
output:
10 TH AC JC AD 2H 7S 6C TS 9C 9D
result:
ok single line: '10 TH AC JC AD 2H 7S 6C TS 9C 9D '
Test #20:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
2D 8D 6C 9H KH TS TC AS 6D 2S 2H 3H 5D QC 9D 5S 4D 5H 4H JC 4C 2C 7S 8S 7D 9S 6H 8H JS JH 3D AD KS 7H AC 3C KD 8C KC QS 4S TD AH QD 5C 7C 9C JD TH 6S 3S QH
output:
20 2D 4C 7S 6H 8H JH 3D KD 8C QS 4S TD AH QD 5C 7C 9C JD 6S 3S
result:
ok single line: '20 2D 4C 7S 6H 8H JH 3D KD 8C QS 4S TD AH QD 5C 7C 9C JD 6S 3S '
Test #21:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
9H 7D AC QH JD 8D 2S KS 9C 9D 7H 7S 4C QC 4H 6S QD 8C JH KD 2C 5C TC 3S 3D 5H KC JS QS 5D 8H 9S TD AD 6H 6D AH 3C 3H TS 4D 7C 8S KH 2D 4S 5S 2H AS TH 6C JC
output:
0
result:
ok single line: '0 '
Test #22:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
JC 7H AH TH 3D 6C 9S 7S QH 7C TD 8S 6S 6H 4C 9C 2H 5H 6D TS 5D 3S 8C 4H 2C AC 4S 8D 5S KS 4D AS KH 9H KD 2D 7D QC JS 2S JH 9D 3H 3C 8H KC AD JD QD TC 5C QS
output:
22 JC 7H 8D 5S 4D AS KH 9H KD 2D 7D QC JS 2S JH 9D 3H 3C 8H KC AD JD
result:
ok single line: '22 JC 7H 8D 5S 4D AS KH 9H KD ... JS 2S JH 9D 3H 3C 8H KC AD JD '
Test #23:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
AH 2C 3D 4S 5H 6C 7D 8S 9H 5S JD QS KH AC 2D 3S 4H 5C 6D 7S 8H 9C TD JS QH KC AD 2S 3H 4C 7C 6S 7H 8C 9D TS JH QC KD AS 2H 3C 4D TC 6H 5D 8D 9S TH JC QD KS
output:
14 AH 2C 3D 4S 5H 6C 7D 8S 8D 9S TH JC QD KS
result:
ok single line: '14 AH 2C 3D 4S 5H 6C 7D 8S 8D 9S TH JC QD KS '
Test #24:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
AH 2C 3D 4S 5H 6C 7D 8S 9H TC JD QS KH AC 2D 3S 4H 5C 6D 7S 8H 9C TD KC JS QH AD 2S 3H 4C 5D 6S 7H 9D 8C TS JH QC KD AS 2H 3C 4D 5S 6H 7C 8D 9S TH JC QD KS
output:
22 AH 2C 3D 4S 5H 9H JH QC KD AS 2H 3C 4D 5S 6H 7C 8D 9S TH JC QD KS
result:
ok single line: '22 AH 2C 3D 4S 5H 9H JH QC KD ... 4D 5S 6H 7C 8D 9S TH JC QD KS '
Test #25:
score: 0
Accepted
time: 0ms
memory: 3776kb
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 KS 5D 6S 7H 8C 9D TS JH QC KD AS 2H 3C 4D 5S 6H 7C 9S 8D TH JC QD 4C
output:
0
result:
ok single line: '0 '
Test #26:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
AH 2H 3H 4C 5S 6S 7S 4H 8H 9S 5H 6H 7H 9H TH JH QH KH AS 2S 3S 4S 8S TS JS QS KS AC 2C 3C 5C 6C 7C 8C 9C TC JC QC KC AD 2D 3D 4D 5D 6D 7D 8D 9D TD JD QD KD
output:
4 TH QH TC QC
result:
ok single line: '4 TH QH TC QC '