QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#867535#2939. Morse Code PalindromesWeaRD276#AC ✓1ms3712kbC++202.3kb2025-01-23 18:22:072025-01-23 18:22:07

Judging History

This is the latest submission verdict.

  • [2025-01-23 18:22:07]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3712kb
  • [2025-01-23 18:22:07]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

#include  <ext/pb_ds/assoc_container.hpp>
#include  <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define x first
#define y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)

typedef long long ll;
typedef double db;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<db, db> pdd;
typedef pair<ll, ll> pll;


int solve()
{
	string str;
	getline(cin, str);
	string s = "";
	for (char ch: str)
	{
		if (isalpha(ch))
			s += toupper(ch);
		else if (isdigit(ch))
			s += ch;
	}
	
	map<char, string> m;
	m['A'] = ".-";
	m['B'] = "-...";
	m['C'] = "-.-.";
	m['D'] = "-..";
	m['E'] = ".";
    m['F'] = "..-.";
    m['G'] = "--.";
    m['H'] = "....";
    m['I'] = "..";
    m['J'] = ".---";
    m['K'] = "-.-";
    m['L'] = ".-..";
    m['M'] = "--";
    m['N'] = "-.";
    m['O'] = "---";
    m['P'] = ".--.";
    m['Q'] = "--.-";
    m['R'] = ".-.";
    m['S'] = "...";
    m['T'] = "-";
    m['U'] = "..-";
    m['V'] = "...-";
    m['W'] = ".--";
    m['X'] = "-..-";
    m['Y'] = "-.--";
    m['Z'] = "--..";
    m['0'] = "-----";
    m['1'] = ".----";
    m['2'] = "..---";
    m['3'] = "...--";
    m['4'] = "....-";
    m['5'] = ".....";
    m['6'] = "-....";
    m['7'] = "--...";
    m['8'] = "---..";
    m['9'] = "----.";
    //cout << s << '\n';
    string mor = "";
    for (char ch: s)
		mor += m[ch];
	
	//cerr << "mor = " << mor << '\n';
	
	string rv = mor;
	reverse(all(rv));
	if (rv == mor && rv != "")
		cout << "YES\n";
	else
		cout << "NO\n";
	
	return 0;
}

int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int TET = 1;
	//cin >> TET;
	for (int i = 1; i <= TET; i++)
	{
		if (solve())
		{
			break;
		}
		#ifdef ONPC
			cerr << "_____________________________\n";
		#endif
	}
	#ifdef ONPC
		cerr << "\nfinished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n";
	#endif
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3712kb

input:

hello

output:

NO

result:

ok single line: 'NO'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

159

output:

YES

result:

ok single line: 'YES'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

Madam I'm Adam

output:

NO

result:

ok single line: 'NO'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

footstool

output:

YES

result:

ok single line: 'YES'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

SOS

output:

YES

result:

ok single line: 'YES'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

e'UX73XB

output:

YES

result:

ok single line: 'YES'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

R2WE&s?FI$ggAvgZQKDMJIAUKDAESIME8R

output:

YES

result:

ok single line: 'YES'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

4n'dA9KqAO.3ghkPLZ9?B e,h%3RmjCENTTQC75IA1IMFATRN4O3MEYNN0SK6

output:

YES

result:

ok single line: 'YES'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

zvnoMVQM4ZeCgYu;PxkjHSWKWUACWAPNTSOHOJ3OWEESTT

output:

YES

result:

ok single line: 'YES'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

3n2B0?nJ8s$XYv8:P,S%8q78OtJemC2fs39?BAHjZvNut1iYPCMm%Nh5AHKE5PqMfIDHg8AD

output:

NO

result:

ok single line: 'NO'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

h3yH6eTyv;enjUAzi9F%LsMB S$I47IDDEOTIUTCWNENNIMPSAIUNOSII

output:

YES

result:

ok single line: 'YES'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

mCu?&i8Nl

output:

NO

result:

ok single line: 'NO'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

zDA%tcl

output:

NO

result:

ok single line: 'NO'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

5rjGHXsxk&1:ms7M,;CsHTJ3EE1MEYEREL6AOTF5

output:

YES

result:

ok single line: 'YES'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

gsNbp1VyHZ'bw$kVNKo.:FOVwGDATK2CTTEERMTHDT6MATEITTZ7RBEM

output:

YES

result:

ok single line: 'YES'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

NVXdeaCzadO6jo,lk?YLUkM

output:

NO

result:

ok single line: 'NO'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

2z?&PcYWbfxM.V0KRtfnoceK;U$4hV&yEp1pMMV4IAyiU5GN1ilY0

output:

NO

result:

ok single line: 'NO'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

dYq06,'k3FF6R'Hp6ji1BOY,yw2wpWWWDTKYNTMN2TTSMBUWI4EIFTEEAUTIRBJONMMEX

output:

YES

result:

ok single line: 'YES'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

p5OKcG:is CZVARdi08;Lm?6ar3NXN3mRh,NclzLuqA,VBFzGin 8z

output:

NO

result:

ok single line: 'NO'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

M:AqX&, &D.if0GES7gDzPRJlnzUnsOPnr:N:s

output:

NO

result:

ok single line: 'NO'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

Rheh6SB8gCEv%7:ej0HN'JvpS,XIwPr1%&l&'R

output:

NO

result:

ok single line: 'NO'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

S!!!### ###!!!

output:

YES

result:

ok single line: 'YES'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

A!!!### ###!!!

output:

NO

result:

ok single line: 'NO'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

A!!!##N# ###!!!

output:

YES

result:

ok single line: 'YES'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

!!!####  .....,,,,???............##########################

output:

NO

result:

ok single line: 'NO'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

SSSSSSSSSSSSSSSSSSSSOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOSSSSSSSSSSSSSSSSSSSS

output:

YES

result:

ok single line: 'YES'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:



output:

NO

result:

ok single line: 'NO'