Submission #12605117


Source Code Expand

Copy
import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M, Q = map(int, readline().split())

A = np.array(list(itertools.combinations_with_replacement(range(1, M + 1), N)))

n = len(A)
score = np.zeros(n, np.int32)
m = map(int, read().split())
for a, b, c, d in zip(m, m, m, m):
    cond = A[:, b - 1] - A[:, a - 1] == c
    score += d * cond

print(score.max())

Submission Info

Submission Time
Task C - Many Requirements
User maspy
Language Python (3.8.2)
Score 300
Code Size 482 Byte
Status AC
Exec Time 214 ms
Memory 46700 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
Sample 00-sample-00, 00-sample-01, 00-sample-02
All 00-sample-00, 00-sample-01, 00-sample-02, 01-handmade-03, 01-handmade-04, 01-handmade-05, 01-handmade-06, 02-random-07, 02-random-08, 02-random-09, 02-random-10, 02-random-11, 02-random-12, 02-random-13, 02-random-14
Case Name Status Exec Time Memory
00-sample-00 AC 145 ms 27120 KB
00-sample-01 AC 98 ms 26804 KB
00-sample-02 AC 189 ms 46568 KB
01-handmade-03 AC 98 ms 27148 KB
01-handmade-04 AC 214 ms 46440 KB
01-handmade-05 AC 212 ms 46700 KB
01-handmade-06 AC 96 ms 26940 KB
02-random-07 AC 96 ms 27004 KB
02-random-08 AC 99 ms 27116 KB
02-random-09 AC 96 ms 27108 KB
02-random-10 AC 98 ms 27068 KB
02-random-11 AC 95 ms 27344 KB
02-random-12 AC 97 ms 27228 KB
02-random-13 AC 106 ms 28276 KB
02-random-14 AC 212 ms 46600 KB