Submission #49723770


Source Code Expand

Copy
#ABC338_20240127_B
N=int(input())
Q=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
flg=1
AR=0
ans=0
while(flg):
Q2=[]
for i in range(N):
q=Q[i]-(A[i]*AR)
if(q>=0):
Q2.append(q)
else:
flg=0
#print(AR,Q2)
if(flg):
nb=10**7
for i in range(N):
if(B[i]!=0):
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#ABC338_20240127_B
N=int(input())
Q=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
flg=1
AR=0
ans=0
while(flg):
    Q2=[]
    for i in range(N):
        q=Q[i]-(A[i]*AR)
        if(q>=0):
            Q2.append(q)
        else:
            flg=0
    #print(AR,Q2)
    if(flg):
        nb=10**7
        for i in range(N):
            if(B[i]!=0):
                qb=Q2[i]//B[i]
            else:
                qb=10**7
            nb=min(qb,nb)
        #print(AR,qb,nb)
        if(nb!=10**7):
            ans=max(AR+nb,ans)
        else:
            flg=1
    AR+=1
print(ans)

Submission Info

Submission Time
Task C - Leftover Recipes
User Konini
Language Python (PyPy 3.10-v7.3.12)
Score 300
Code Size 659 Byte
Status AC
Exec Time 124 ms
Memory 82988 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 18
Set Name Test Cases
Sample 01-sample.txt, 02-sample.txt, 03-sample.txt, 04-sample.txt
All 01-sample.txt, 02-sample.txt, 03-sample.txt, 04-sample.txt, 05-hidden.txt, 06-hidden.txt, 07-hidden.txt, 08-hidden.txt, 09-hidden.txt, 10-hidden.txt, 11-hidden.txt, 12-hidden.txt, 13-hidden.txt, 14-hidden.txt, 15-hidden.txt, 16-hidden.txt, 17-hidden.txt, 18-hidden.txt
Case Name Status Exec Time Memory
01-sample.txt AC 55 ms 76660 KB
02-sample.txt AC 56 ms 76440 KB
03-sample.txt AC 56 ms 76740 KB
04-sample.txt AC 77 ms 82648 KB
05-hidden.txt AC 55 ms 76328 KB
06-hidden.txt AC 62 ms 81744 KB
07-hidden.txt AC 97 ms 82812 KB
08-hidden.txt AC 82 ms 82820 KB
09-hidden.txt AC 124 ms 82956 KB
10-hidden.txt AC 85 ms 82988 KB
11-hidden.txt AC 72 ms 82984 KB
12-hidden.txt AC 68 ms 81944 KB
13-hidden.txt AC 71 ms 82900 KB
14-hidden.txt AC 66 ms 81912 KB
15-hidden.txt AC 55 ms 76460 KB
16-hidden.txt AC 80 ms 82628 KB
17-hidden.txt AC 56 ms 76444 KB
18-hidden.txt AC 55 ms 76676 KB


2025-04-03 (Thu)
23:56:58 +00:00