Xmas Contest 2016 昼の部

Submission #1038731

Source codeソースコード

def check(arr):
    if 1:
        # D
        n = arr[0]
        if n+1 > len(arr) or not 1 <= n <= 10**5:
            #print "D len"
            return 0
        x = {}
        for e in arr[1:n+1]:
            if e in x or not 1 <= e <= 10**9:
                #print "D ele"
                return 0
            x[e] = 1

    # E

    # F
    if 1:
        t = arr[0]
        if 4*t+1 > len(arr) or not 1 <= t <= 100:
            #print "F"
            return 0
        for i in xrange(t):
            n, a, b, k = arr[1+4*i:5+4*i]
            if not 1 <= n <= a+b or not 0 <= k <= n or not 0 <= a <= 100 or not 0 <= b <= 100:
                #print "F"
                return 0

    # G
    if 1:
        n, m = arr[0:2]
        if not 2 <= n <= 500000 or not 0 <= m <= 500000 or 2+n+4*m > len(arr):
            #print "G"
            return 0
        # 1 <= ci <= 10**9
        for i in xrange(n):
            if not 1 <= arr[2+i] <= 10**9:
                #print "G"
                return 0
        for i in xrange(m):
            s, t, a, b = arr[2+n+4*i:6+n+4*i]
            if not 1 <= a <= n-1 or not 1 <= s < t <= 10**9 or not 1 <= b <= 10**9:
                #print "G"
                return 0

    # H
    if 1:
        n, k = arr[0:2]
        if not 2 <= k <= n <= 200000 or 2+3*(n-1) > len(arr):
            #print "H"
            return 0
        for i in xrange(n-1):
            a, b, c = arr[2+3*i:5+3*i]
            if not 1 <= a <= n or not 1 <= b <= n or a==b or not 1 <= c <= 5000:
                #print "H"
                return 0
    return 1

import random
random.seed()
ri = random.randint
while 1:
    n = ri(2, 20)
    arr = [ri(1, 3) for i in xrange(n)]
    #print arr
    if check(arr):
        #print arr
        break
for i in xrange(30*50*200-len(arr)):
    arr.append(1)
print 30*50*200
print " ".join(map(str, arr))

Submission

Task問題 J - Just a Single Testcase
User nameユーザ名 すごぷろ/ちゃっく
Created time投稿日時
Language言語 Python2 (2.7.6)
Status状態 WA
Score得点 50
Source lengthソースコード長 1926 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
dataset1 50 / 50 1.txt
dataset2 0 / 50 2.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
1.txt AC 187 ms 9872 KB
2.txt WA