hiho week 62 register

Ended

Participants:714

Verdict:Accepted
Score:100 / 100
Submitted:2015-09-11 23:37:23

Lang:Python2

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
a=[int(i) for i in raw_input().split()]
cache=[]
answer=[]
for i in xrange(1,a[0]+1):
    target=raw_input()
    if not (target in cache):
        if len(cache)<a[-1]:
            cache.append(target)
        else:
            del cache[0]
            cache.append(target)
        answer.append("Internet")
    else:
        answer.append("Cache")
        cache.remove(target)
        cache.append(target)
for i in answer:
    print i
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX