QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#39612 | #2939. Morse Code Palindromes | CJ | AC ✓ | 3ms | 3652kb | C++ | 1.3kb | 2022-07-12 15:46:16 | 2022-07-12 15:46:17 |
Judging History
answer
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string s,t,r;
getline(cin,s);
for(int i=0;i<s.size();i++)
{
if(s[i]>='a'&&s[i]<='z')
s[i]-=32;
if((s[i]>='0'&&s[i]<='9')||
(s[i]>='A'&&s[i]<='Z'))
t+=s[i];
}
for(int i=0;i<t.size();i++)
{
if(t[i]=='A')r+="01";
if(t[i]=='B')r+="1000";
if(t[i]=='C')r+="1010";
if(t[i]=='D')r+="100";
if(t[i]=='E')r+="0";
if(t[i]=='F')r+="0010";
if(t[i]=='G')r+="110";
if(t[i]=='H')r+="0000";
if(t[i]=='I')r+="00";
if(t[i]=='J')r+="0111";
if(t[i]=='K')r+="101";
if(t[i]=='L')r+="0100";
if(t[i]=='M')r+="11";
if(t[i]=='N')r+="10";
if(t[i]=='O')r+="111";
if(t[i]=='P')r+="0110";
if(t[i]=='Q')r+="1101";
if(t[i]=='R')r+="010";
if(t[i]=='S')r+="000";
if(t[i]=='T')r+="1";
if(t[i]=='U')r+="001";
if(t[i]=='V')r+="0001";
if(t[i]=='W')r+="011";
if(t[i]=='X')r+="1001";
if(t[i]=='Y')r+="1011";
if(t[i]=='Z')r+="1100";
if(t[i]=='1')r+="01111";
if(t[i]=='2')r+="00111";
if(t[i]=='3')r+="00011";
if(t[i]=='4')r+="00001";
if(t[i]=='5')r+="00000";
if(t[i]=='6')r+="10000";
if(t[i]=='7')r+="11000";
if(t[i]=='8')r+="11100";
if(t[i]=='9')r+="11110";
if(t[i]=='0')r+="11111";
}
s=r;
reverse(r.begin(),r.end());
if(s==r&&!r.empty())cout<<"YES";
else cout<<"NO";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 3500kb
input:
hello
output:
NO
result:
ok single line: 'NO'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3624kb
input:
159
output:
YES
result:
ok single line: 'YES'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
Madam I'm Adam
output:
NO
result:
ok single line: 'NO'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3572kb
input:
footstool
output:
YES
result:
ok single line: 'YES'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3440kb
input:
SOS
output:
YES
result:
ok single line: 'YES'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3652kb
input:
e'UX73XB
output:
YES
result:
ok single line: 'YES'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3580kb
input:
R2WE&s?FI$ggAvgZQKDMJIAUKDAESIME8R
output:
YES
result:
ok single line: 'YES'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3556kb
input:
4n'dA9KqAO.3ghkPLZ9?B e,h%3RmjCENTTQC75IA1IMFATRN4O3MEYNN0SK6
output:
YES
result:
ok single line: 'YES'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3444kb
input:
zvnoMVQM4ZeCgYu;PxkjHSWKWUACWAPNTSOHOJ3OWEESTT
output:
YES
result:
ok single line: 'YES'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3532kb
input:
3n2B0?nJ8s$XYv8:P,S%8q78OtJemC2fs39?BAHjZvNut1iYPCMm%Nh5AHKE5PqMfIDHg8AD
output:
NO
result:
ok single line: 'NO'
Test #11:
score: 0
Accepted
time: 2ms
memory: 3576kb
input:
h3yH6eTyv;enjUAzi9F%LsMB S$I47IDDEOTIUTCWNENNIMPSAIUNOSII
output:
YES
result:
ok single line: 'YES'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3592kb
input:
mCu?&i8Nl
output:
NO
result:
ok single line: 'NO'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3572kb
input:
zDA%tcl
output:
NO
result:
ok single line: 'NO'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
5rjGHXsxk&1:ms7M,;CsHTJ3EE1MEYEREL6AOTF5
output:
YES
result:
ok single line: 'YES'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3448kb
input:
gsNbp1VyHZ'bw$kVNKo.:FOVwGDATK2CTTEERMTHDT6MATEITTZ7RBEM
output:
YES
result:
ok single line: 'YES'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
NVXdeaCzadO6jo,lk?YLUkM
output:
NO
result:
ok single line: 'NO'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
2z?&PcYWbfxM.V0KRtfnoceK;U$4hV&yEp1pMMV4IAyiU5GN1ilY0
output:
NO
result:
ok single line: 'NO'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
dYq06,'k3FF6R'Hp6ji1BOY,yw2wpWWWDTKYNTMN2TTSMBUWI4EIFTEEAUTIRBJONMMEX
output:
YES
result:
ok single line: 'YES'
Test #19:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
p5OKcG:is CZVARdi08;Lm?6ar3NXN3mRh,NclzLuqA,VBFzGin 8z
output:
NO
result:
ok single line: 'NO'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
M:AqX&, &D.if0GES7gDzPRJlnzUnsOPnr:N:s
output:
NO
result:
ok single line: 'NO'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3628kb
input:
Rheh6SB8gCEv%7:ej0HN'JvpS,XIwPr1%&l&'R
output:
NO
result:
ok single line: 'NO'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
S!!!### ###!!!
output:
YES
result:
ok single line: 'YES'
Test #23:
score: 0
Accepted
time: 2ms
memory: 3648kb
input:
A!!!### ###!!!
output:
NO
result:
ok single line: 'NO'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
A!!!##N# ###!!!
output:
YES
result:
ok single line: 'YES'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
!!!#### .....,,,,???............##########################
output:
NO
result:
ok single line: 'NO'
Test #26:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
SSSSSSSSSSSSSSSSSSSSOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOSSSSSSSSSSSSSSSSSSSS
output:
YES
result:
ok single line: 'YES'
Test #27:
score: 0
Accepted
time: 2ms
memory: 3444kb
input:
output:
NO
result:
ok single line: 'NO'