[Offer收割]编程练习赛24 register

Ended

Participants:356

Verdict:Time Limit Exceeded
Score:90 / 100
Submitted:2017-08-27 13:46:32

Lang:Python2

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
n = int(raw_input())
raw_MAP = raw_input().split()
q = int(raw_input())
MAP = []
for i in raw_MAP:
    MAP.append(int(i))
for i in range(q):
    this = raw_input()
    this_c = this.split()
    if this_c[0] == '1':
        now = int(this_c[1])
        re = 0
        while now <= n:
            re += 1
            now += MAP[now - 1]
        print re
    else:
        MAP[int(this_c[1])-1] = int(this_c[2])
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX