QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#316789 | #8170. $N^a (\log N)^b$ | ucup-team992# | RE | 35ms | 27816kb | Python3 | 1.0kb | 2024-01-28 03:55:30 | 2024-01-28 03:55:30 |
Judging History
answer
import sys
sys.setrecursionlimit(1000000)
F = input()
idx = 0
def peek():
global idx
if idx == len(F):
return None
return F[idx]
def expr():
global idx
ts = term()
while peek() == '+':
idx += 1
ts = max(ts, term())
return ts
def term():
global idx
fs = factor()
while peek() == '*':
idx += 1
f2 = factor()
fs[0] += f2[0]
fs[1] += f2[1]
fs[2] = fs[2] or f2[2]
return fs
def factor():
global idx
if peek() == 'N':
idx += 1
v = 1
if peek() == '^':
idx += 1
v = number()
return [v, 0, False]
if peek() == 'l':
idx += 4 # log(
ex = expr()
idx += 1 #)
v = 1
if peek() == '^':
idx += 1
v = number()
ex2 = [0, v if ex[0] > 0 else 0, (ex[1] > 0) or ex[2]]
return ex2
if peek() == '(':
idx += 1
ex = expr()
idx += 1 #)
return ex
def number():
global idx
i0 = idx
while peek() in '0123456789':
idx += 1
return int(F[i0:idx])
R = expr()
if R[2]:
R[1] += 1
print(R[0], R[1])
详细
Test #1:
score: 100
Accepted
time: 6ms
memory: 9436kb
input:
N*log(N^2)*log(N)+N+log(N^1+N)^2*N
output:
1 2
result:
ok 2 tokens
Test #2:
score: 0
Accepted
time: 10ms
memory: 9352kb
input:
N*log(log(N))
output:
1 1
result:
ok 2 tokens
Test #3:
score: 0
Accepted
time: 0ms
memory: 9496kb
input:
(((N))*N^234567890+N^2)
output:
234567891 0
result:
ok 2 tokens
Test #4:
score: 0
Accepted
time: 15ms
memory: 9428kb
input:
log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)+log(N)...
output:
0 1
result:
ok 2 tokens
Test #5:
score: 0
Accepted
time: 21ms
memory: 9508kb
input:
log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)*log(N)...
output:
0 14285
result:
ok 2 tokens
Test #6:
score: 0
Accepted
time: 24ms
memory: 16812kb
input:
log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(log(...
output:
0 1
result:
ok 2 tokens
Test #7:
score: 0
Accepted
time: 35ms
memory: 27816kb
input:
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
output:
0 1
result:
ok 2 tokens
Test #8:
score: 0
Accepted
time: 24ms
memory: 9596kb
input:
log(log(N^39187693)^548521633+log(log(N*N^2+N*N^71962925)+log(N*N+N)*log(N+N)+log((log(log(N)^8))*log(log(N*N*N))))*log((N+log(N)*N+N*log(N)^958544341))^978444210)+log((log(N)^573073630)*log(log(N)^857299008)*(N+N^3+log(N))*log(N)+log(log(N^5943+((N*N)*N^3371597)+N*N*(N)*N^3732602)^195356379)^910014...
output:
0 706139983
result:
ok 2 tokens
Test #9:
score: 0
Accepted
time: 24ms
memory: 9744kb
input:
(log((N*log(log(log(N+N))+N*N+log(N*N*log(N)*N+N^88)*(log(N^39775+(N*N*N^39+(log((N^3509)))))^223188793))^106803375*(N*N*N*(N+N)*N^60976)*(log(log(N*N^8*(N*N)+N^4)+log(N)^87804)*log(log((N+N+N^63*N^49+N)+N)*log(N^24556108*log(N^28*(N)+log(N*N+(N)+log(N)^743*N))+N^86041+(N^276*(N+N+((N)))*log(N+N)^75...
output:
0 242619919
result:
ok 2 tokens
Test #10:
score: 0
Accepted
time: 28ms
memory: 9716kb
input:
log(log((((N)*N^60+(N+(N)*N))*N+(N+N)*log((log(N+log(N)^5)^99743452*(N*N*(N)*log(N)^849510749)))*log(N*N^13087+N)+log((N^1000000000*log(N)*N^388)*log(N*N^647*N*log((N^7)+N*N^445)+N)^908094458)^225370592+log((N+N^7467+log(N)^8852684)*log(((N)*N*log(N)^996)))^829473139+log(log((N*N)+N)^683248757*N^385...
output:
2474266 1883498746
result:
ok 2 tokens
Test #11:
score: 0
Accepted
time: 28ms
memory: 9656kb
input:
log(((log(log(log(log(log(log(N)^7)+N^80)*log(log(N+N+(N)+(N)+(N*N+log(N)*log((log(N*N))))*N^2*(log(log(log(N))^921759665)*(N*N)*(N^1)))*log(N+N*(N^409*(log(N+N*N)))*N^6))*(((N^9*N)*log((N+N*N)+N*log(N)^1+((N)*(N*(N+N)+N*N+(N)))))+log(log(log(log(N+N)^831866480)*log((N^633*log(log(N^323*(N))*N^5))*(...
output:
0 2
result:
ok 2 tokens
Test #12:
score: -100
Dangerous Syscalls
input:
(log(log((((log(log(log((N+N))^413593551)*(((N+N)*N*N*log((N)+N)))+(log(N+N+N+N*N^3+N)^336010059+N*N*log(N*N+N^19033)^825819051*log(N*(N)))+log(N+N+(N)*N*N^851241117*(log(N)^957547))^183676983)*(log((log(N*log(N)^5144*log((N*log((N)+log(N)^554955)))^426823799)^606862955*(((N)+N+N)+N^3)*((((N+log(log...