Submission #175232


Source Code Expand

#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
from collections import defaultdict

K,M = map(int, sys.stdin.readline().rstrip().split())
As = map(int, sys.stdin.readline().rstrip().split())
Cs = map(int, sys.stdin.readline().rstrip().split())

starti = len(As)
term = None
for i in xrange(len(As), len(As)+5000):
    #print format(As[-1], 'b')
    restk = i % len(Cs)
    As.append(reduce(lambda x,y: x^y, [(Cs[j-1]&As[i-j]) for j in xrange(1, K+1)]))
    if i>starti+100 and As[starti+1] == As[i] and As[starti] == As[i-1]:
        term = i - starti - 1
        break

#print "term",term
#print As
print As[(M-1)%term]

exit(0)

Submission Info

Submission Time
Task D - 漸化式
User hiking
Language Python (2.7.3)
Score 0
Code Size 673 Byte
Status RE
Exec Time 353 ms
Memory 8500 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 3
RE × 14
Set Name Test Cases
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, small_1.txt, small_2.txt
Case Name Status Exec Time Memory
random_01.txt AC 59 ms 3616 KB
random_02.txt RE 221 ms 8492 KB
random_03.txt RE 144 ms 8492 KB
random_04.txt RE 148 ms 8424 KB
random_05.txt RE 158 ms 8448 KB
random_06.txt RE 163 ms 8440 KB
random_07.txt RE 200 ms 8492 KB
random_08.txt RE 246 ms 8424 KB
random_09.txt RE 346 ms 8500 KB
random_10.txt RE 353 ms 8488 KB
random_11.txt RE 350 ms 8488 KB
random_12.txt RE 343 ms 8360 KB
random_13.txt RE 347 ms 8492 KB
random_14.txt RE 353 ms 8496 KB
random_15.txt RE 345 ms 8444 KB
sample_1.txt AC 53 ms 3540 KB
sample_2.txt AC 53 ms 3612 KB
sample_3.txt RE 205 ms 8492 KB
small_1.txt AC 53 ms 3612 KB
small_2.txt AC 52 ms 3612 KB