QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#83784#46. PiratesYawn_Sean50 ✓35ms10112kbPython33.5kb2023-03-03 14:52:022023-03-03 14:52:04

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-03 14:52:04]
  • 评测
  • 测评结果:50
  • 用时:35ms
  • 内存:10112kb
  • [2023-03-03 14:52:02]
  • 提交

answer

import time
import bisect
import functools
import math
import os
import random
import re
import sys
import threading
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import cmp_to_key, lru_cache, reduce
from heapq import heapify, heappop, heappush, heappushpop, nlargest, nsmallest
from io import BytesIO, IOBase
from itertools import accumulate, combinations, permutations
from operator import add, iand, ior, itemgetter, mul, xor
from string import ascii_lowercase, ascii_uppercase
from typing import *

BUFSIZE = 4096
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin = IOWrapper(sys.stdin)
sys.stdout = IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

def I():
    return input()

def II():
    return int(input())

def MII():
    return map(int, input().split())

def LI():
    return list(input().split())

def LII():
    return list(map(int, input().split()))

def GMI():
    return map(lambda x: int(x) - 1, input().split())

def LGMI():
    return list(map(lambda x: int(x) - 1, input().split()))

inf = float('inf')

# from types import GeneratorType

# def bootstrap(f, stack=[]):
#     def wrappedfunc(*args, **kwargs):
#         if stack:
#             return f(*args, **kwargs)
#         else:
#             to = f(*args, **kwargs)
#             while True:
#                 if type(to) is GeneratorType:
#                     stack.append(to)
#                     to = next(to)
#                 else:
#                     stack.pop()
#                     if not stack:
#                         break
#                     to = stack[-1].send(to)
#             return to
#     return wrappedfunc

# RANDOM = random.getrandbits(32)

# class Wrapper(int):
#     def __init__(self, x):
#         int.__init__(x)

#     def __hash__(self):
#         return super(Wrapper, self).__hash__() ^ RANDOM


n = II()
s = I()
cnt = Counter(s)
print(*cnt.most_common()[0])

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 2.5
Accepted
time: 31ms
memory: 10000kb

input:

1
a

output:

a 1

result:

ok single line: 'a 1'

Test #2:

score: 2.5
Accepted
time: 28ms
memory: 10016kb

input:

50
hpdoypydsjjbrflbqehxgvyyyqhtzsawrlpfgpwztepgsapffw

output:

p 6

result:

ok single line: 'p 6'

Test #3:

score: 2.5
Accepted
time: 18ms
memory: 10104kb

input:

50
ekxzicouuxfoaafacrevbzrkjqnzauhcguihkntnilgiphgase

output:

a 5

result:

ok single line: 'a 5'

Test #4:

score: 2.5
Accepted
time: 21ms
memory: 9996kb

input:

50
lwqahlveuyleogcdgpshnkeqkmlrnctvymyjuablpvgnitclxo

output:

l 6

result:

ok single line: 'l 6'

Test #5:

score: 2.5
Accepted
time: 23ms
memory: 9988kb

input:

50
ygrmrrfkwbkorubwjxqxzeprbtfuhlvvrpqznkuhvjbokuqtsr

output:

r 7

result:

ok single line: 'r 7'

Test #6:

score: 2.5
Accepted
time: 14ms
memory: 10108kb

input:

50
pqntqusybvefkspypzqoqspqzimkmlkknhzmbwaafjdyemvcvg

output:

q 5

result:

ok single line: 'q 5'

Test #7:

score: 2.5
Accepted
time: 19ms
memory: 10112kb

input:

100
zmcydqewcegjhihditaigyjdcfskgispkutzqbbdhfegynhbrtrnopvfpengixwvzvjriiaabzawgqwoxkvdsqteylruefuiyhcn

output:

i 8

result:

ok single line: 'i 8'

Test #8:

score: 2.5
Accepted
time: 23ms
memory: 9968kb

input:

100
owkfuohimmfmajqcnoljqcipvrzvrfkifyqjjuxqqqfagclhsyltvfqtlbysgmtuvqsuwaesuyujakfxpthjuojyaaqollepmcpb

output:

q 9

result:

ok single line: 'q 9'

Test #9:

score: 2.5
Accepted
time: 25ms
memory: 9980kb

input:

200
kvirktyytcmbfwsabtbqfzvilpfsgshteqydzprftopcwwswcrnehokavyjscjpaeyqmhokqfsqntjpbvpuievovrfgkwpwepdoiwygybrghatskyfxezfrbhzkbulbvwwrgielieisetpwkgsmkolyttljcbifbawcvcmnvnjakwyothqzlfljlxmmlgbxieldgqdhl

output:

w 12

result:

ok single line: 'w 12'

Test #10:

score: 2.5
Accepted
time: 33ms
memory: 9984kb

input:

201
fzyivvcgrjqwwzgxhpjivechkodbwpsxjczeokztzmzdefiymyozyqmbveexafysklcdmnockyxsqxonxtaghhlzqmowiabteggbtlxyirzybxomvlchicnfpeanepalzndmcktkzchdiodcrfkiktowdlfrivjrjpetlpivdzbeggykmvkepfrrvvhozsisqkchgmlmj

output:

z 13

result:

ok single line: 'z 13'

Test #11:

score: 2.5
Accepted
time: 25ms
memory: 9972kb

input:

500
irtdljupgnqevbfzxdtwgogixkuucukrzgliqrfmbapiagzrlufjrnsdzrxzfmpbhazzjuahdrfqrwghpwbdgugozuqmjyapibqrwckaggqcxglpvmlufkjghxfaggzekmmkazjhbzrvnhfzofqrrrgvighqkhgdkmvvimakmfqrppckzkljqhzksolkclureqqadczvnezxkcigroshbgbtnftkgqmywsomimrtnazdldficdmkskbrdtsuhnzhzlfipgbvarwirvznkwmzbyaabiecxrmxhkstbplw...

output:

z 28

result:

ok single line: 'z 28'

Test #12:

score: 2.5
Accepted
time: 34ms
memory: 9908kb

input:

2
aa

output:

a 2

result:

ok single line: 'a 2'

Test #13:

score: 2.5
Accepted
time: 20ms
memory: 9992kb

input:

500
lknpfgrsbgkhtiqbervsfpjqhlsohirospfwtsdqxajhdlhcqdxqbfaiqfjbovenbigxreehxdviloprpvdbkcaogkvtrqacieirxfwxypkcsbumaulhoaqnghvgrkhkrioxihczovooeqsianwkffagmgmadvffnaemvarsfdhmrxcwwcssclgahzuhpjkxrzdfljajsghlsjcvzekilegfaioddntzatwudwtxsugyhelutshdslchiymhmkebinngpbqtpybktjyaepjuvgauqzsijbnbrqezifte...

output:

a 27

result:

ok single line: 'a 27'

Test #14:

score: 2.5
Accepted
time: 25ms
memory: 10032kb

input:

3
xyy

output:

y 2

result:

ok single line: 'y 2'

Test #15:

score: 2.5
Accepted
time: 25ms
memory: 9984kb

input:

3
aba

output:

a 2

result:

ok single line: 'a 2'

Test #16:

score: 2.5
Accepted
time: 19ms
memory: 9976kb

input:

10
ktuonxnmrf

output:

n 2

result:

ok single line: 'n 2'

Test #17:

score: 2.5
Accepted
time: 35ms
memory: 9928kb

input:

10
tjsgrjpndc

output:

j 2

result:

ok single line: 'j 2'

Test #18:

score: 2.5
Accepted
time: 19ms
memory: 10028kb

input:

10
ktkyfdttcc

output:

t 3

result:

ok single line: 't 3'

Test #19:

score: 2.5
Accepted
time: 22ms
memory: 9980kb

input:

10
bbatscqewm

output:

b 2

result:

ok single line: 'b 2'

Test #20:

score: 2.5
Accepted
time: 14ms
memory: 9972kb

input:

10
eptazubsuj

output:

u 2

result:

ok single line: 'u 2'