CSES - Datatähti 2024 loppu - Results
Submission details
Task:Sukat
Sender:maweiyin24562
Submission time:2024-01-20 15:33:51 +0200
Language:C++ (C++11)
Status:READY
Result:28
Feedback
groupverdictscore
#1ACCEPTED28
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 2, 3details
#2ACCEPTED0.00 s1, 2, 3details
#3ACCEPTED0.00 s1, 2, 3details
#4ACCEPTED0.00 s1, 2, 3details
#5ACCEPTED0.00 s1, 2, 3details
#6ACCEPTED0.00 s1, 2, 3details
#7ACCEPTED0.00 s1, 2, 3details
#8ACCEPTED0.01 s2, 3details
#9ACCEPTED0.00 s2, 3details
#100.00 s2, 3details
#110.00 s2, 3details
#12ACCEPTED0.00 s2, 3details
#13ACCEPTED0.00 s2, 3details
#14ACCEPTED0.00 s2, 3details
#15ACCEPTED0.16 s3details
#16ACCEPTED0.01 s3details
#170.15 s3details
#180.15 s3details
#19ACCEPTED0.16 s3details
#20ACCEPTED0.16 s3details
#210.04 s3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:46:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for(ll i=0;i<s.size();i++){
      |                ~^~~~~~~~~

Code

#include<iostream>
#include<string>

using namespace std;

typedef long long ll;

string s;
ll idx[100];

ll ans;
char anslist[100009][2];

struct Node{
    ll cnt,id;
};

Node MaxList(){
    Node ret;
    ret.id=0;
    ret.cnt=0;
    for(ll i=0;i<26;i++){
        if(idx[i]>ret.cnt){
            ret.cnt=idx[i];
            ret.id=i;
        }
    }
    return ret;
}

Node MinList(){
    Node ret;
    ret.id=0;
    ret.cnt=1e9;
    for(ll i=25;i>0;i--){
        if(idx[i]<ret.cnt&&idx[i]!=0){
            ret.cnt=idx[i];
            ret.id=i;
        }
    }
    return ret;
}

int main(){
    cin>>s;
    for(ll i=0;i<s.size();i++){
        idx[s[i]-'A']++;
    }
    Node a1=MaxList(),a2=MinList();
    while(a1.cnt>0){
        if(a1.id==a2.id)break;
        idx[a1.id]--;
        idx[a2.id]--;
        ans++;
        anslist[ans][0]=a1.id+'A';
        anslist[ans][1]=a2.id+'A';
        a1=MaxList();
        a2=MinList();
    }
    cout<<ans<<endl;
    for(ll i=1;i<=ans;i++){
        cout<<anslist[i][0]<<anslist[i][1]<<endl;
    }
    return 0;
}

Test details

Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
QBAXGXJZJS

correct output
5
XJ
ZX
SQ
JG
...

user output
5
JZ
XS
AX
BQ
...

Test 2

Group: 1, 2, 3

Verdict: ACCEPTED

input
SSSSSSSSSS

correct output
0

user output
0

Test 3

Group: 1, 2, 3

Verdict: ACCEPTED

input
SETTSESEEE

correct output
5
ES
ET
ES
ET
...

user output
5
ET
ET
ES
ES
...

Test 4

Group: 1, 2, 3

Verdict: ACCEPTED

input
SSMRSSSSKR

correct output
4
SR
SR
SM
SK

user output
4
SM
SK
SR
SR

Test 5

Group: 1, 2, 3

Verdict: ACCEPTED

input
BIIILIIRRL

correct output
5
IR
IL
IR
IL
...

user output
5
IB
IR
IR
IL
...

Test 6

Group: 1, 2, 3

Verdict: ACCEPTED

input
YYGEYTDSTY

correct output
5
YT
YT
YS
YG
...

user output
5
YS
YG
TE
YT
...

Test 7

Group: 1, 2, 3

Verdict: ACCEPTED

input
MMMMMMMMMN

correct output
1
MN

user output
1
MN

Test 8

Group: 2, 3

Verdict: ACCEPTED

input
XQQZJQDDJOWXDFVQUIODDJIZIQDQIW...

correct output
500
DQ
DQ
DQ
DQ
...

user output
500
DT
DT
DN
DN
...
Truncated

Test 9

Group: 2, 3

Verdict: ACCEPTED

input
IIIIIIIIIIIIIIIIIIIIIIIIIIIIII...

correct output
0

user output
0

Test 10

Group: 2, 3

Verdict:

input
KEOHHYHHAIHLLHEKIHKAHHHHOHEHHE...

correct output
493
HA
HA
HA
HA
...

user output
428
HZ
HX
HJ
HM
...
Truncated

Test 11

Group: 2, 3

Verdict:

input
WNNFXQNODQFSQVQQPNLQNQNNVVNXHN...

correct output
499
NQ
NQ
NQ
NQ
...

user output
476
NU
NU
NU
NZ
...
Truncated

Test 12

Group: 2, 3

Verdict: ACCEPTED

input
VGAHMMMXMMVXAAMMMOMMMXVMMMYMXT...

correct output
500
MH
MH
MH
MH
...

user output
500
MG
MJ
MJ
MJ
...
Truncated

Test 13

Group: 2, 3

Verdict: ACCEPTED

input
KKKKUUAKKAUKKKKFKKSVKCWKKKCVOJ...

correct output
500
KI
KI
KI
KI
...

user output
500
KY
KY
KH
KH
...
Truncated

Test 14

Group: 2, 3

Verdict: ACCEPTED

input
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV...

correct output
100
VP
VP
VP
VP
...

user output
100
VG
VN
VN
VE
...
Truncated

Test 15

Group: 3

Verdict: ACCEPTED

input
FKKJJBWTSFCDEKFPOKIPWZSVKHACMC...

correct output
100000
CK
CK
CK
CK
...

user output
100000
CN
CN
CN
CN
...
Truncated

Test 16

Group: 3

Verdict: ACCEPTED

input
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...

correct output
0

user output
0

Test 17

Group: 3

Verdict:

input
WVKKVVADNVCVKLVYVVZVKVCTNKVLVV...

correct output
99925
VC
VC
VC
VC
...

user output
96249
VO
VO
VO
VO
...
Truncated

Test 18

Group: 3

Verdict:

input
BBBBBDNXDZQXBBYBBWBSBTMADXBBVZ...

correct output
99999
BE
BE
BE
BE
...

user output
97518
BR
BR
BR
BR
...
Truncated

Test 19

Group: 3

Verdict: ACCEPTED

input
FBRDPLUMLZMLLLUFUCLEMCMULLZLFL...

correct output
100000
LU
LU
LU
LU
...

user output
100000
LK
LK
LK
LK
...
Truncated

Test 20

Group: 3

Verdict: ACCEPTED

input
UUBUBUTUJSLUVBUXTUUMUXUXTMXUXS...

correct output
100000
UX
UX
UX
UX
...

user output
100000
UO
UO
UO
UO
...
Truncated

Test 21

Group: 3

Verdict:

input
PPPPPPPPPPEPPPPPPPPPPBOPPPPPPP...

correct output
20000
PB
PB
PB
PB
...

user output
18404
PM
PM
PM
PM
...
Truncated