QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#629124 | #2939. Morse Code Palindromes | Tenshi# | AC ✓ | 1ms | 3844kb | C++23 | 1.9kb | 2024-10-11 05:17:00 | 2024-10-11 05:17:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ": " << (x) << endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define x first
#define y second
using pii = pair<int, int>;
using ll = long long;
inline void read(int &x){
int s=0; x=1;
char ch=getchar();
while(ch<'0' || ch>'9') {if(ch=='-')x=-1;ch=getchar();}
while(ch>='0' && ch<='9') s=(s<<3)+(s<<1)+ch-'0',ch=getchar();
x*=s;
}
bool ok(string s){
if(s=="") return false;
string t=s;
reverse(all(t));
return s==t;
}
string decode(char c){
string x;
x+=c;
if(x=="A") return "01";
if(x=="B") return "1000";
if(x=="C") return "1010";
if(x=="D") return "100";
if(x=="E") return "0";
if(x=="F") return "0010";
if(x=="G") return "110";
if(x=="H") return "0000";
if(x=="I") return "00";
if(x=="J") return "0111";
if(x=="K") return "101";
if(x=="L") return "0100";
if(x=="M") return "11";
if(x=="N") return "10";
if(x=="O") return "111";
if(x=="P") return "0110";
if(x=="Q") return "1101";
if(x=="R") return "010";
if(x=="S") return "000";
if(x=="T") return "1";
if(x=="U") return "001";
if(x=="V") return "0001";
if(x=="W") return "011";
if(x=="X") return "1001";
if(x=="Y") return "1011";
if(x=="Z") return "1100";
if(x=="0") return "11111";
if(x=="1") return "01111";
if(x=="2") return "00111";
if(x=="3") return "00011";
if(x=="4") return "00001";
if(x=="5") return "00000";
if(x=="6") return "10000";
if(x=="7") return "11000";
if(x=="8") return "11100";
if(x=="9") return "11110";
while(1);
}
signed main(){
string s;
getline(cin, s);
string t;
for(auto e: s){
if(isalpha(e) || isdigit(e)){
t+=decode(toupper(e));
}
}
puts(ok(t)? "YES": "NO");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3828kb
input:
hello
output:
NO
result:
ok single line: 'NO'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
159
output:
YES
result:
ok single line: 'YES'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
Madam I'm Adam
output:
NO
result:
ok single line: 'NO'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
footstool
output:
YES
result:
ok single line: 'YES'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
SOS
output:
YES
result:
ok single line: 'YES'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3484kb
input:
e'UX73XB
output:
YES
result:
ok single line: 'YES'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
R2WE&s?FI$ggAvgZQKDMJIAUKDAESIME8R
output:
YES
result:
ok single line: 'YES'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
4n'dA9KqAO.3ghkPLZ9?B e,h%3RmjCENTTQC75IA1IMFATRN4O3MEYNN0SK6
output:
YES
result:
ok single line: 'YES'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
zvnoMVQM4ZeCgYu;PxkjHSWKWUACWAPNTSOHOJ3OWEESTT
output:
YES
result:
ok single line: 'YES'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
3n2B0?nJ8s$XYv8:P,S%8q78OtJemC2fs39?BAHjZvNut1iYPCMm%Nh5AHKE5PqMfIDHg8AD
output:
NO
result:
ok single line: 'NO'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
h3yH6eTyv;enjUAzi9F%LsMB S$I47IDDEOTIUTCWNENNIMPSAIUNOSII
output:
YES
result:
ok single line: 'YES'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
mCu?&i8Nl
output:
NO
result:
ok single line: 'NO'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
zDA%tcl
output:
NO
result:
ok single line: 'NO'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
5rjGHXsxk&1:ms7M,;CsHTJ3EE1MEYEREL6AOTF5
output:
YES
result:
ok single line: 'YES'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
gsNbp1VyHZ'bw$kVNKo.:FOVwGDATK2CTTEERMTHDT6MATEITTZ7RBEM
output:
YES
result:
ok single line: 'YES'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
NVXdeaCzadO6jo,lk?YLUkM
output:
NO
result:
ok single line: 'NO'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
2z?&PcYWbfxM.V0KRtfnoceK;U$4hV&yEp1pMMV4IAyiU5GN1ilY0
output:
NO
result:
ok single line: 'NO'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
dYq06,'k3FF6R'Hp6ji1BOY,yw2wpWWWDTKYNTMN2TTSMBUWI4EIFTEEAUTIRBJONMMEX
output:
YES
result:
ok single line: 'YES'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
p5OKcG:is CZVARdi08;Lm?6ar3NXN3mRh,NclzLuqA,VBFzGin 8z
output:
NO
result:
ok single line: 'NO'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
M:AqX&, &D.if0GES7gDzPRJlnzUnsOPnr:N:s
output:
NO
result:
ok single line: 'NO'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
Rheh6SB8gCEv%7:ej0HN'JvpS,XIwPr1%&l&'R
output:
NO
result:
ok single line: 'NO'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
S!!!### ###!!!
output:
YES
result:
ok single line: 'YES'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
A!!!### ###!!!
output:
NO
result:
ok single line: 'NO'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
A!!!##N# ###!!!
output:
YES
result:
ok single line: 'YES'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
!!!#### .....,,,,???............##########################
output:
NO
result:
ok single line: 'NO'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
SSSSSSSSSSSSSSSSSSSSOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOSSSSSSSSSSSSSSSSSSSS
output:
YES
result:
ok single line: 'YES'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
output:
NO
result:
ok single line: 'NO'