problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 262k 1.05M | problem_description stringlengths 48 1.55k | codes stringlengths 35 98.9k | status stringlengths 28 1.7k | submission_ids stringlengths 28 1.41k | memories stringlengths 13 808 | cpu_times stringlengths 11 610 | code_sizes stringlengths 7 505 |
|---|---|---|---|---|---|---|---|---|---|---|
p02971 | u941284420 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\na = [ int(input()) for i in range(N) ]\n\nmax_a = max(a)\nans = [max_a]*N\nmax_index = []\nfor i in range(N):\n if a[i] == max_a:\n max_index.append(i)\ntry:\n sec_max_a = max([i for i in a if i !=max_a])\nexcept:\n print(*ans)\nelse:\n for i in max_index:\n ans[i]=sec_max_a\n print(*ans)... | ['Wrong Answer', 'Accepted'] | ['s618548916', 's394918190'] | [25064.0, 22012.0] | [487.0, 575.0] | [302, 276] |
p02971 | u942915776 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n = int(input())\na_list = [int(input()) for _ in range(n)]\nif a_list[0] > a_list[1]:\n i_max = 0\n i_max2 = 1\nelse:\n i_max = 1\n i_max2 = 0\na_max = a_list[i_max]\na_max2 = a_list[i_max2]\nfor i, a in enumerate(a_list):\n if i < 2:\n continue\n if a > a_max:\n i_max2 = i_max\n ... | ['Wrong Answer', 'Accepted'] | ['s693405788', 's174281247'] | [12532.0, 12520.0] | [529.0, 521.0] | [549, 507] |
p02971 | u943057856 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\nA = [int(input()) for _ in range(N)]\nA_max = max(A)\nfor i in range(N):\n if A[0] != max(A):\n print(max(A))\n else:\n B = A.copy()\n del B[i]\n print(max(B))', 'N = int(input())\nA = [int(input()) for _ in range(N)]\nB = sorted(A,reverse=True)\nfor i in range(N):\... | ['Wrong Answer', 'Accepted'] | ['s062646144', 's709537598'] | [15584.0, 14112.0] | [2104.0, 549.0] | [202, 170] |
p02971 | u945181840 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\nA = [int(input()) for i in range(N)]\nm1, m2 = sorted(A, reverse=True)[:2]\n\nfor i in range(N):\n if i == p:\n print(m2)\n else:\n print(m1)', 'N = int(input())\nA = [int(input()) for i in range(N)]\np = A.index(max(A))\nm1, m2 = sorted(A, reverse=True)[:2]\n\nfor i in range(N):... | ['Runtime Error', 'Accepted'] | ['s100864496', 's478001137'] | [13340.0, 13340.0] | [390.0, 548.0] | [171, 191] |
p02971 | u948524308 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\nA = [0]*N\n\nfor i in range(N):\n A[i] = int(input())\n\n\nfor i in range(N):\n if i == 0:\n print(max(A[1:N]))\n else:\n print(max(max(A[:i]),max(A[i:N])))\n', ' = int(input())\nA = [0]*N\n\nfor i in range(N):\n A[i] = int(input())\n\nmx = max(A)\nmxi = A.index(max(A))\n\n... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s158628789', 's912681025', 's267116699'] | [12504.0, 2940.0, 15012.0] | [2104.0, 17.0, 571.0] | [187, 315, 210] |
p02971 | u955865009 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n = int(input())\nl = []\nm = []\n\nfor i in range(n):\n l.append(int(input()))\n\nx = 0\ny = 0\ncount = 0\n\nfor i in l:\n for j in l:\n if i == j:\n count += 1\n\nfor i in l:\n if i > x:\n x = i\n \nif count > 2:\n for i in range(n):\n print(x)\n\nelse:\n for i ... | ['Wrong Answer', 'Accepted'] | ['s432774781', 's100113304'] | [16984.0, 19212.0] | [2206.0, 434.0] | [490, 336] |
p02971 | u958581328 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n = int(input())\nnums = [int(input()) for i in range(n)]\nn_max = max(nums)\nex_nums = [i for i in nums].remove(n_max)\nn_semi_max = max(ex_nums)\nfor i in nums:\n if i == n_max:\n print(n_semi_max)\n else:\n print(n_max)', "SEQUENCE_LEN_MIN = 2\nSEQUENCE_LEN_MAX = 200000\nNUMERIC_MIN = 1\nNUMERI... | ['Runtime Error', 'Accepted'] | ['s898080783', 's304447937'] | [12588.0, 12532.0] | [332.0, 572.0] | [233, 2049] |
p02971 | u959340534 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n = int(input())\nA = []\nf = 0\ns = 0\nfor _ in range(n):\n a = int(input())\n if f >= a:\n s = f\n f = a\n\nfor a in A:\n if a == f:\n print(s)\n else:\n print(f)', 'n = int(input())\nA = []\nf = 0\ns = 0\nfor _ in range(n):\n a = int(input())\n A.append(a)\n if f <= a:\n s = f\n f = a\n e... | ['Wrong Answer', 'Accepted'] | ['s366843942', 's901565381'] | [9116.0, 17024.0] | [265.0, 350.0] | [166, 205] |
p02971 | u962479059 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N=int(input())\nA=[0 for i in range(N)]\nfor i in range(N):\n A[i]=int(input())\n\nfor i in range(N):\n if i == A.index(max(A)):\n A.pop(i)\n A.sort\n print(A[N-2])\n else:\n print(max(A))', 'N=int(input())\nA=[0 for i in range(N)]\nfor i in range(N):\n A[i]=int(input())\nmax1=max(A)\nnumbers_of_max1=... | ['Runtime Error', 'Accepted'] | ['s263942367', 's902758375'] | [11048.0, 14072.0] | [2104.0, 548.0] | [192, 374] |
p02971 | u962858258 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\nA = []\nfor i in range(N):\n A.append(int(input()))\nB = A.copy()\nB.sort()\nB.reverse()\nprint(B)\nprint(A)\nfor i in range(0,N):\n if A[i] == B[0]:\n print(B[1])\n else:\n print(B[0])\n', 'N = int(input())\nA = []\nfor i in range(N):\n A.ap... | ['Wrong Answer', 'Accepted'] | ['s303889361', 's168647918'] | [20320.0, 14064.0] | [622.0, 557.0] | [242, 224] |
p02971 | u963915126 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n = int(input())\na = []\n\nmaxa = 0\nmaxa1 = 0\nmaxcnt = 0\nfor i in range(n):\n ai = int(input())\n a.append(ai)\n if maxa < ai:\n maxa1 = maxa\n maxa = ai\n maxcnt = 0\n elif maxa == ai:\n maxcnt += 1\n\nfor i in range(n):\n if a[i] == maxa:\n if maxcnt > 0:\n ... | ['Wrong Answer', 'Accepted'] | ['s448899500', 's578293016'] | [12628.0, 12568.0] | [582.0, 573.0] | [387, 427] |
p02971 | u963963908 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['#ABC134 C\n\nN = int(input())\nA = []\nfor i in range(N):\n a = int(input())\n A.append(a)\nA.sort()\nprint(sum(A) - A[0])', '\n\nN = int(input())\nA = []\nfor i in range(N):\n a = int(input())\n A.append(a)\n \nAA = sorted(A,reverse = True)\nfor i in range(N):\n if A[i] != AA[0]:\n print(AA[... | ['Wrong Answer', 'Accepted'] | ['s548668628', 's747975884'] | [17456.0, 19096.0] | [311.0, 395.0] | [120, 230] |
p02971 | u964880659 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['import copy\n\nn = int(input())\n\ncolumns = [int(input()) for i in range(n)]\n\ni = 0\n\nwhile i < n:\n if columns[i] == max(columns):\n print(sorted(set(columns))[-1])\n else:\n print(max(columns))\n i += 1', 'import copy\nn = int(input())\n \ncolumns = [int(input()) for i in range(n)]\n\nsor... | ['Wrong Answer', 'Accepted'] | ['s277868139', 's500474343'] | [11544.0, 14584.0] | [2104.0, 547.0] | [218, 259] |
p02971 | u966378542 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n = int(input())\nno1 = -1\nno1_i = -1\nno2 = -2\nno2_i = -1\nS = []\nfor _ in range(n):\n S.append(int(input()))\n\nfor i in range(n):\n \tif s[i] > no1:\n \tno1_i = i\n \tno1 = s[i]\n elif s[i] > no2:\n \tno2_i = i\n \tno2 = s[i]\n \nfor i in range(n):\n \tif no1_i == i:\n \tprint(no2)\n ... | ['Runtime Error', 'Accepted'] | ['s296916344', 's504301268'] | [2940.0, 12532.0] | [17.0, 528.0] | [315, 304] |
p02971 | u968846084 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n=int(input())\na=[int(input()) for _ in range(n)]\nb=max(a)\nc=a.count(b)\nif c>1:\n for i in range(n):\n print(b)\nelse:\n d=sorted(a, reverse=True)\n e=d[1]\n f=0\n h=0\n while f!=b:\n g=a[h]\n if f<g:\n f=g\n h=h+1\n print(h)\n for i in range(h-1):\n print(b)\n print(e)\n for i in ra... | ['Wrong Answer', 'Accepted'] | ['s488814690', 's266737691'] | [14068.0, 14176.0] | [561.0, 580.0] | [324, 313] |
p02971 | u969708690 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['L=list()\nN=int(input())\nfor i in range(N):\n a=int(input())\n L.append(a)\nL=L.sorted(L)\nc=L[-1]\nd=L[-2]\nfor i in range(N):\n if L[i]==c:\n print(d)\n else:\n print(c)', 'L=list()\nN=int(input())\nfor i in range(N):\n a=int(input())\n L.append(a)\nc=max(L)\nd=sorted(L)[-2]\nfor i in range(N):\n if L... | ['Runtime Error', 'Accepted'] | ['s163235050', 's333867437'] | [11052.0, 13384.0] | [362.0, 581.0] | [170, 165] |
p02971 | u970197315 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\na = []\nb = 0\na.append(int(input()))\n\n\nfor i in range(N):\n b = a[i]\n a[i] = 0\n print(max(a))\n a[i] = b\n', 'n=int(input())\na=[int(input()) for i in range(n)]\nl=[0]*n\nr=[0]*n\nt=0\nfor i in range(n):\n t=max(t,a[i])\n l[i]=t\nt=0\nfor i in range(n-1,-1,-1):\n t=max(t,a[i])\n... | ['Runtime Error', 'Accepted'] | ['s053988240', 's724074245'] | [3060.0, 20112.0] | [17.0, 488.0] | [151, 325] |
p02971 | u971237642 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['# -*- coding: utf-8 -*-\n\nn = int(input())\na = ["" for _ in range(n)]\n\nfor i in range(n):\n a[i] = int(input())\n\n\nans = ["" for _ in range(n)]\nfor i in range(n):\n a_test = a[:]\n del a_test[i]\n ans[i] = max(a_test)\n\nprint(ans)\n', '# -*- coding: utf-8 -*-\n\nn = int(input())\na = [int(input())... | ['Wrong Answer', 'Accepted'] | ['s604723997', 's457916367'] | [15656.0, 14068.0] | [2104.0, 472.0] | [236, 337] |
p02971 | u978962055 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\na = [int(input()) for i in range(N)]\na.sort(reverse=True)\namax = a[0]\nfor i in range(len(a)):\n if a[i]==amax:\n print(a[i+1])\n else:\n print(amax)', 'N = int(input())\na = [int(input()) for i in range(N)]\na.sort(reverse=True)\namax = a[0]\nfor i in range(len(a)):\n if a[i]==amax:\n ... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s071573842', 's318595611', 's688239815', 's933378897', 's958209944'] | [12512.0, 12512.0, 12528.0, 13380.0, 13404.0] | [592.0, 589.0, 553.0, 532.0, 542.0] | [169, 167, 181, 190, 171] |
p02971 | u982139831 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n = int(input())\na = list(map(int,[input() for i in range(n)]))\na_set = set(a)\n\nfor num in a:\n print(max(a))', 'N = int(input())\nA = []\nfor i in range(N):\n A.append(int(input()))\nmax_A = max(A)\nmax_num = 0\nfor i in range(N):\n if A[i] == max_A:\n \n max_num += 1\n if max_num > 1... | ['Wrong Answer', 'Accepted'] | ['s582272629', 's530151817'] | [23728.0, 15604.0] | [2105.0, 531.0] | [109, 350] |
p02971 | u983367697 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n=int(input());\nnum_list=[];\nfor i in range(n):\n num_list.append(int(input()));\n m=max(num_list)\nfor j in range(n):\n if(num_list[j]==m):\n num_list[j]=0;\n print(max(num_list))\n print(m);\n', 'n=int(input())\nnum_list=[]\ntop1=0\ntop2=0\nfor i in range(n):\n num_list.append(int(inp... | ['Wrong Answer', 'Accepted'] | ['s750661225', 's262905904'] | [3572.0, 12512.0] | [2104.0, 538.0] | [212, 291] |
p02971 | u984276646 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\nA = list(map(int, input()))\nm, i = 0, -1\nfor j in range(len(A)):\n if A[j] > m:\n m, i = A[j], j\nB = A[:]\nB.remove(m)\nM = max(B)\nfor k in range(len(A)):\n if k != i:\n A[k] = m\n else:\n A[k] = M\nfor l in range(len(A)):\n print(A[l])', 'N = int(input())\nA = []\nfor c in range(N)... | ['Runtime Error', 'Accepted'] | ['s310131211', 's802444632'] | [3064.0, 14060.0] | [17.0, 579.0] | [256, 279] |
p02971 | u986594273 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n = int(input())\na = [0]*(n)\nnum = 0\nmax = 0\nsmax = 0\nfor i in range(n):\n a[i] = int(input())\nfor i in range(n):\n if a[i] > max:\n max = a[i]\n num = i\nfor j in range(n):\n if j != i:\n if a[j] > smax:\n smax = a[j]\nfor j in range(n):\n if j == i:\n max = s... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s438685817', 's513046600', 's225958648'] | [12508.0, 12552.0, 13384.0] | [539.0, 529.0, 544.0] | [319, 321, 207] |
p02971 | u987164499 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['from sys import stdin\nn = int(stdin.readline().rstrip())\nli = list(int(stdin.readline().rstrip()) for _ in range(n))\none = max(li)\ntwo = sorted(li)[-2]\nfor i in range(n):\n if max(li) == li[i]:\n print(two)\n else:\n print(max(one))', 'from sys import stdin\nn = int(stdin.readline().rstrip())... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s367242593', 's388355604', 's520950981', 's567270892', 's339167206'] | [13392.0, 11044.0, 16104.0, 2940.0, 14120.0] | [2104.0, 2104.0, 2105.0, 17.0, 373.0] | [248, 235, 345, 247, 255] |
p02971 | u989345508 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['\n\nn=int(input())\na=[int(input()) for i in range(n)]\nm1=max(a)\nm2=sorted(a,reverse=True)[1]\nfor i in range(n):\n if m==a[i]:\n print(m2)\n else:\n print(m1)\n', '\n\nn=int(input())\na=[int(input()) for i in range(n)]\nm1=max(a)\nm2=sorted(a,reverse=True)[1]\nfor i in range(n):\n if m1==a[i... | ['Runtime Error', 'Accepted'] | ['s483460944', 's921006871'] | [13340.0, 13340.0] | [387.0, 547.0] | [265, 266] |
p02971 | u991148747 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['n = int(input())\nlist = []\nfor i in range(0,n):\n list.append(int(input()))\n \nnew_list = sorted(list, reverse=True)\nfor lst in new_list:\n print(lst)', 'n = int(input())\nlist = []\nfor i in range(0,n):\n list.append(int(input()))\n \nnew_list = sorted(list, reverse=True)\nprint lst in new_list:\n print(ls... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s158233570', 's864948527', 's435556027'] | [14112.0, 2940.0, 14112.0] | [584.0, 17.0, 605.0] | [150, 152, 248] |
p02971 | u991619971 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['#import numpy as np\n#from itertools import combinations as comb\n#from itertools import combinations_with_replacement as comb_with\nfrom itertools import permutations as perm\n\n\nN = int(input())\n#H1,M1,H2,M2,K= map(int,input().split())\n#A = list(map(int,input().split()))\n#B = list(map(int,input().split()))\n#S=... | ['Wrong Answer', 'Accepted'] | ['s509671764', 's667553958'] | [143768.0, 14076.0] | [2104.0, 480.0] | [466, 493] |
p02971 | u993435350 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\nL = []\nfor l in range(N):\n\tL.append(int(input()))\n\nmaxL = max(L)\nnum = ["n"] * N\n\nif L.count(maxL) >= 2:\n\tfor i in range(N):\n\t\tprint(maxL)\n\t\t\nelse:\n\tL = L.remove(maxL)\n\tsecL = max(L)\n\t\n\tfor i in range(N):\n\t\tif i in num:\n\t\t\tprint(secL)\n\t\telse:\n\t\t\tprint(maxL)\n',... | ['Runtime Error', 'Accepted'] | ['s487469578', 's760916659'] | [14048.0, 14196.0] | [500.0, 521.0] | [275, 265] |
p02971 | u995102075 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\nA = [int(input()) for _ in range(N)]\n\nans = []\nfront_max = back_max = 0\n\nfor i in reversed(range(N)):\n now = A[-1]\n A[-1] = 0\n front_max = max(A) if A else 0\n ans.append(max(front_max, back_max))\n back_max = max(now, back_max)\n\nfor i in reversed(range(N)):\n print(ans[i... | ['Wrong Answer', 'Accepted'] | ['s048257911', 's289763566'] | [11052.0, 14112.0] | [2104.0, 595.0] | [307, 208] |
p02971 | u995102267 | 2,000 | 1,048,576 | You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. | ['N = int(input())\nA = tuple(int(input()) for i in range(N)\n\nB = list(A)\n\nfor j in range(N):\n B.pop(j)\n print(max(B))\n B = list(A)', 'N = int(input())\nA = list(int(input()) for i in range(N))\n\nmax_value = max(A)\nnumber = A.count(max_value)\n\nif number > 1:\n for j in range(N):\n print(ma... | ['Runtime Error', 'Accepted'] | ['s573303257', 's054719270'] | [2940.0, 12520.0] | [17.0, 512.0] | [137, 351] |
p02973 | u054514819 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import sys\ndef input(): return sys.stdin.readline().strip()\ndef mapint(): return map(int, input().split())\nsys.setrecursionlimit(10**9)\n\nN = int(input())\nAs = [-int(input()) for _ in range(N)]\n\nfrom bisect import bisect_left\nlis = [1]\nfor a in As:\n if a>=lis[-1]:\n lis.append(a)\n else:\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s286516242', 's666273979', 's738376612'] | [13708.0, 139024.0, 13600.0] | [107.0, 2031.0, 107.0] | [354, 345, 354] |
p02973 | u062459048 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['N = int(input())\nA = [map(int, input()) for i in range(N)]\n\ncount = 0\ntemp = []\ntempin = []\nfor i in range(N):\n if i in tempin:\n continue\n temp.append(A[i])\n for j in range(i+1, N):\n if j in tempin:\n continue\n elif temp[-1] < A[j]:\n temp.append(A[j])\n tempin.append(j)\n else... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s125433650', 's929165972', 's050445334'] | [26912.0, 7720.0, 8092.0] | [238.0, 2104.0, 272.0] | [350, 346, 279] |
p02973 | u064408584 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['n=int(input())\na=[int(input())]\nfor i in range(n-1):\n t=int(input())\n b=bisect.bisect_left(a[::-1], t)\n if b==0:\n a.append(t)\n else:\n a[-b]=t\nprint(len(a))', 'import bisect\nfrom collections import deque\nn=int(input())\na=deque([int(input())])\nfor i in range(n-1):\n t=int(input... | ['Runtime Error', 'Accepted'] | ['s868238541', 's246619458'] | [3060.0, 7284.0] | [17.0, 575.0] | [181, 245] |
p02973 | u073549161 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['n = int(input())\ndat = []\nfor i in range(n):\n dat.append(int(input()))\nres = []\nres.append(0 - dat[0])\n\nimport bisect\n\nfor i in range(1, n):\n print(res)\n a = bisect.bisect_right(res, 0 - dat[i])\n print("a={0}".format(a))\n\n if a == len(res):\n res.append( (0 - dat[i]) )\n else:\n... | ['Runtime Error', 'Accepted'] | ['s010820041', 's110211866'] | [138376.0, 11036.0] | [1843.0, 260.0] | [347, 349] |
p02973 | u075595666 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from heapq import*\n(N,M),*t=[map(int,s.split())for s in open(0)]\nq=[0]*10**5\nv=[[]for _ in q]\nz=0\nfor a,b in t:v[a-1]+=[b]\nfor i in v[:M]:\n\tfor j in i:heappush(q,-j)\n\tz-=heappop(q)\nprint(z)', 'from heapq import*\n(N,M),*t=[map(int,s.split())for s in open(0)]\nq=[0]*7**6\nv=[[]for _ in q]\nz=0\nfor a,b in t... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s292096398', 's322761765', 's528964042', 's463400768'] | [44916.0, 44916.0, 44916.0, 8092.0] | [171.0, 181.0, 161.0, 418.0] | [189, 188, 198, 431] |
p02973 | u076512055 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\nN = int(input())\nA = [int(input()) for n in range(N)]\n\ntree = [[A[0]]]\nleaf = [A[0]]\nfor n in range(1,N):\n a = A[n]\n pos = min(n-1,bisect.bisect_left(leaf,a)-1)\n if pos==-1:\n tree = a + tree\n leaf = a + leaf\n else:\n tree[pos].append(a)\n leaf[pos] = a... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s045358629', 's900336807', 's844172962'] | [7696.0, 7720.0, 18428.0] | [225.0, 2104.0, 934.0] | [321, 325, 373] |
p02973 | u081193942 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\n\n\ndef main():\n n = int(input())\n a = [int(input()) for _ in range(n)]\n\n tail = []\n len_tail = 0\n for ai in a:\n print(tail, ai)\n idx = bisect.bisect_left(tail, -ai, lo=0, hi=len_tail) \n if idx == len_tail:\n tail.append(-ai)\n len_tail += 1\n else:\n tail[idx] ... | ['Runtime Error', 'Accepted'] | ['s288101662', 's885449010'] | [138308.0, 11032.0] | [1830.0, 277.0] | [366, 348] |
p02973 | u102960641 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\n\nn = int(input())\na = sorted([int(input()) for i in range(n)])\nLIS = [a[0]]\nfor i in range(len(a)):\n if a[i] >= LIS[-1]:\n LIS.append(a[i])\n else:\n LIS[bisect.bisect_left(LIS, a[i])] = a[i]\nprint(len(LIS)-1)', 'import bisect\n\nn = int(input())\na = [int(input()) for i in ra... | ['Wrong Answer', 'Accepted'] | ['s689566509', 's439924731'] | [8188.0, 8472.0] | [222.0, 213.0] | [240, 217] |
p02973 | u108617242 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\ndef LIS():\n L[0] = A[0]\n length = 1\n for i in range(1, N):\n print(A[i])\n if L[length-1] < A[i]:\n L[length] = A[i]\n length += 1\n else:\n j = bisect.bisect_left(L, A[i])\n L[min(length-1, j)] = A[i]\n return length\n\nde... | ['Wrong Answer', 'Accepted'] | ['s086759693', 's597999532'] | [14424.0, 7864.0] | [434.0, 253.0] | [748, 690] |
p02973 | u135346354 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import heapq\nN = int(input())\n\nS = list(int(input()) for _ in range(N))\n\nd = [S[0]]\ncnt = 1\nfor i in range(1, N):\n temp = S[i]\n if d[0] >= S[i]:\n heapq.heappush(d, temp)\n cnt += 1\n continue\n ok = 0\n ng = cnt-1\n t = (ok+ng)//2\n while ok+1 < ng:\n t = (ok+ng... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s341563360', 's680362503', 's444099721'] | [13836.0, 13396.0, 13564.0] | [2206.0, 2206.0, 1803.0] | [430, 334, 360] |
p02973 | u147305315 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import collections\nn = int(input())\na = []\nfor i in range(n):\n a.append(int(input()))\nc = collections.Counter(a)\nprint(c.most_common()[1])', 'import bisect\nimport collections\nn = int(input())\na = []\nfor i in range(n):\n a.append(int(input()))\nm = collections.deque([])\nfor i in range(0, n):\n j = ... | ['Runtime Error', 'Accepted'] | ['s155482166', 's185157356'] | [21204.0, 8060.0] | [233.0, 531.0] | [141, 276] |
p02973 | u148079233 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from bisect import bisect\n\n\ndef main():\n N = int(input())\n A = [int(input()) for _ in range(N)]\n L = [A[0]]\n for a in A[1:]:\n if a <= L[-1]:\n L.append(a)\n else:\n i = bisect(L, a)\n L[i] = a\n print(len(L))\n\n \n\nif __name__ == "__main__":\n... | ['Runtime Error', 'Accepted'] | ['s613647349', 's650419946'] | [8612.0, 8604.0] | [183.0, 239.0] | [311, 289] |
p02973 | u163320134 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\n\nn=int(input())\narr=[int(input()) for _ in range(n)][::-1]\nLIS = [arr[0]]\nfor i in range(1,n):\n print(LIS)\n if arr[i] >= LIS[-1]:\n LIS.append(arr[i])\n else:\n LIS[bisect.bisect_left(LIS, arr[i])] = arr[i]\nprint(len(LIS))', 'import collections\nimport bisect\n\nn=int(input())\narr=[int... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s206653619', 's217383993', 's697959991', 's812277705', 's780818248'] | [138252.0, 138584.0, 12136.0, 11600.0, 11036.0] | [2094.0, 2104.0, 281.0, 280.0, 239.0] | [242, 362, 344, 338, 246] |
p02973 | u179169725 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ["\nimport sys\nread = sys.stdin.readline\n\n\ndef read_a_int():\n return int(read())\n\n\nfrom bisect import bisect_left, bisect_right, insort_left\nfrom array import array\n\n\nclass BinarySearchTree:\n def __init__(self, ls: list = []):\n \n self.bst = array('q' sorted(ls)) \n\n \n # r... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s388760530', 's845060575', 's633413676'] | [2940.0, 3444.0, 4408.0] | [18.0, 22.0, 1674.0] | [3593, 3541, 3607] |
p02973 | u185948224 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['n = int(input())\na = [int(input()) for _ in range(n)]\nprint(a)\nans = 0\nlst = [a[0]]*2\nfor aa in a:\n if aa <= lst[0]:\n lst[0] = aa\n ans += 1\n elif lst[0] < aa <= lst[1]:\n lst[0] = aa\n elif aa > lst[1]:\n lst[1] = aa\n else: lst[0] = aa\nprint(ans)', 'from bisect impor... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s085520696', 's829182250', 's270993514'] | [15316.0, 15148.0, 14332.0] | [162.0, 205.0, 189.0] | [283, 233, 224] |
p02973 | u193264896 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ["import sys\nfrom bisect import bisect_right\nread = sys.stdin.read\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\n\ndef main():\n N = int(readline())\n A = list(int(readline()) for _ in range(N))\n\n LIS = [INF]*N\n A.reverse()\n for a in... | ['Wrong Answer', 'Accepted'] | ['s571446939', 's505700625'] | [13824.0, 13896.0] | [91.0, 93.0] | [433, 445] |
p02973 | u201234972 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ["import sys\ninput = sys.stdin.readlinefrom collections import deque\nfrom bisect import bisect_right, bisect_left\ndef main():\n N = int( input())\n A = [ int( input()) for _ in range(N)]\n d = deque()\n for a in A:\n t = bisect_right(d, a)\n if t == 0:\n d.appendleft(a)\n ... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s009834499', 's838100463', 's952064822', 's652009761'] | [2940.0, 2940.0, 12752.0, 8060.0] | [17.0, 17.0, 738.0, 626.0] | [519, 519, 530, 520] |
p02973 | u203022424 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['\nn = int(input())\na = []\nfor i in range(n):\n a.append(int(input()))\n\nimport bisect\n\ncolor = []\ncolor.append(a.pop(0))\ncolor_count =0 \nfor i, ai in enumerate(a): \n index = bisect.bisect_left(color, ai)\n print(index-1, ai, color)\n if index > 0:\n color[index -1] = ai\n else:\n c... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s274234455', 's540417540', 's735171090', 's298349233'] | [138268.0, 138672.0, 7072.0, 8080.0] | [2027.0, 2104.0, 2104.0, 529.0] | [344, 358, 407, 314] |
p02973 | u212919262 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import sys\ninput = sys.stdin.readline\n\nN = int(input())\nl = [int(input())]\n\nfor i in range(N-1):\n ai = int(input())\n flag = False\n for m in l:\n if max(m) < ai:\n m.append(ai)\n flag = True\n break\n if flag == False:\n l.append([ai])\n \nprint(len(l))', 'import sys\ninput = sys.s... | ['Runtime Error', 'Accepted'] | ['s983523591', 's427385738'] | [3064.0, 7068.0] | [18.0, 107.0] | [272, 339] |
p02973 | u228223940 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import sys\nimport numpy as np\nfrom scipy.misc import comb\nsys.setrecursionlimit(1000000)\n \nn = int(input())\n\na = [int(input()) for i in range(n)]\n\ncolor = [[-1] for i in range(n+1)]\n\nmax_j = 0\nfor i in range(n):\n for j in range(n):\n #print(color[j][-1])\n if a[i] > color[j][-1]:\n ... | ['Time Limit Exceeded', 'Accepted'] | ['s284907610', 's667733920'] | [29456.0, 8064.0] | [2113.0, 414.0] | [408, 347] |
p02973 | u257162238 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import sys\ninput = sys.stdin.readline\nimport numpy as np\nfrom numba import njit\n\n\ndef read():\n N = int(input().strip())\n A = [int(input().strip()) for _ in range(N)]\n return N, A\n\n\n@njit\ndef segtree_init(size, init_value=10**8, dtype=np.int32):\n \n n = 1\n while size > 1:\n size... | ['Runtime Error', 'Accepted'] | ['s276654907', 's515563397'] | [119944.0, 13720.0] | [1470.0, 102.0] | [2642, 629] |
p02973 | u281303342 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['# Python3 (3.4.3)\nimport sys\ninput = sys.stdin.readline\n\n# -------------------------------------------------------------\n# function\n# -------------------------------------------------------------\n\n\n# -------------------------------------------------------------\n# main\n# ------------------------------------... | ['Runtime Error', 'Accepted'] | ['s568678020', 's416072874'] | [138632.0, 8092.0] | [2012.0, 401.0] | [597, 582] |
p02973 | u327162583 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\n\nN = input()\nN = int(N)\nS = [-int(input()) for _ in range(N)]\nresult = []\n\nfor i in range(N):\n hoge = bisect.bisect_left(result,S[i])\n if hoge == 0:\n result.append(S[i])\n else:\n result[hoge - 1] = S[i]\nprint(len(result))', 'import bisect\n\nN = input()\nN = int(N)\nS ... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s167527539', 's268039145', 's282754183', 's488546802', 's348251440'] | [7832.0, 7076.0, 7072.0, 11048.0, 7840.0] | [244.0, 174.0, 176.0, 248.0, 248.0] | [257, 259, 264, 293, 258] |
p02973 | u347640436 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from bisect import bisect_right\n\nN = int(input())\nA = [int(input()) for _ in range(N)]\n\nt = deque([-A[0]])\nfor a in A[1:]:\n if -a <= -t[0]:\n t.append(-a)\n else:\n t[bisect_right(t, -a)] = -a\nprint(len(t))\n', 'from random import random\nfrom sys import setrecursionlimit\n\nsetrecursionli... | ['Runtime Error', 'Accepted'] | ['s295223093', 's221921706'] | [7076.0, 44040.0] | [171.0, 1159.0] | [224, 3127] |
p02973 | u353797797 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from bisect import *\n\ndef f(n):\n r = []\n for _ in range(n):\n a = int(input())\n if not r:\n r.append(a)\n continue\n i = bisect_left(r, a)\n if i:\n r[i]=a\n else:\n r = [a] + r\n print(len(r))\n\nn = int(input())\nf(n)\n', '... | ['Runtime Error', 'Accepted'] | ['s500547162', 's611043763'] | [4552.0, 7284.0] | [2104.0, 393.0] | [296, 327] |
p02973 | u368796742 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\nn = int(input())\nl = []\nl.append(int(input()))\nfor i in range(n-1):\n a = int(input())\n if l[0] >= a:\n l.insert(0,a)\n else:\n l[bisect.bisect_left(l,a+1)-1] = a\nprint(l)', 'import bisect\nfrom collections import deque\nn = int(input())\nl = deque([])\nl.append(int(input())... | ['Wrong Answer', 'Accepted'] | ['s569963742', 's351294181'] | [8160.0, 7412.0] | [2104.0, 309.0] | [204, 247] |
p02973 | u369752439 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import collections\n\nN = int(input()) \ncolor_list = []\ncolor_list.append(int(input()))\nfor i in range(N-1):\n new_value = int(input())\n if(new_value > color_list[0]):\n color_list[0] = new_value\n elif(new_value <= color_list[-1]):\n color_list.append(new_value)\n else:\n for ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s252183125', 's845111235', 's451948944'] | [7684.0, 7076.0, 7072.0] | [2104.0, 247.0, 445.0] | [449, 353, 623] |
p02973 | u389910364 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\nimport heapq\nimport itertools\nimport math\nimport os\nimport re\nimport string\nimport sys\nfrom collections import Counter, deque, defaultdict\nfrom copy import deepcopy\nfrom decimal import Decimal\nfrom fractions import gcd\nfrom functools import lru_cache, reduce\nfrom operator import itemgetter\... | ['Wrong Answer', 'Accepted'] | ['s722788866', 's811498771'] | [26928.0, 8068.0] | [2109.0, 422.0] | [830, 570] |
p02973 | u392319141 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['N = int(input())\n\na = int(input())\nmaxVal = [a]\n\nans = 1\nfor _ in range(N-1) :\n a = int(input())\n i = 0\n for i in range(len(maxVal)) :\n if a <= maxVal[i] :\n maxVal.append(a)\n ans += 1\n break\n else :\n maxVal[i] = max(maxVal[i] , a)\n\n\nprint(an... | ['Wrong Answer', 'Accepted'] | ['s782628411', 's674961122'] | [7084.0, 11064.0] | [395.0, 227.0] | [302, 197] |
p02973 | u405256066 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from sys import stdin\nfrom bisect import bisect\n\nN = int(stdin.readline().rstrip())\nA = [int(x) for x in stdin.readline().rstrip().split()]\n\ndp = []\nfor a in A[::-1]:\n i = bisect(dp, a)\n if i < len(dp):\n dp[i] = a\n else:\n dp.append(a)\nprint(len(dp))', 'from sys import stdin\nfrom b... | ['Wrong Answer', 'Accepted'] | ['s957084644', 's301790930'] | [3064.0, 8600.0] | [18.0, 257.0] | [272, 269] |
p02973 | u434282696 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\n\nn = int(input())\na = []\n\nfor i in range(n):\n a.append(int(input()))\n\na.reverse()\ncnt = 0\nfor i in range(1,n):\n if a[i] + cnt == c[i-1]:\n cnt += 1\n a[i] += cnt\n \nINF = 10000000000\ndp = [INF] * n\n\nfor i in range(n):\n t = bisect.bisect_left(dp,a[i])\n if t !... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s146140833', 's563521114', 's042708826'] | [7072.0, 7840.0, 9332.0] | [193.0, 233.0, 257.0] | [358, 222, 243] |
p02973 | u465171275 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\n\nn = int(input())\na = [int(input()) for _ in range(n)]\nt = [a[-1]]\n\nfor i in reversed(a[:-1]):\n idx = bisect.bisect_left(t, i + 1)\n print(i, idx)\n if idx == len(t):\n t.append(i)\n\n else:\n t[idx] = i\n print(t)\n\nprint(len(t))', 'import bisect\n \nn = int(input()... | ['Runtime Error', 'Accepted'] | ['s618589432', 's957863770'] | [138980.0, 8604.0] | [2070.0, 237.0] | [265, 427] |
p02973 | u473291366 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\nN = int(input())\nA = deque()\nfor _ in range(N):\n x = int(input())\n i = bisect.bisect_left(A,x)\n j = bisect.bisect_right(A,x)\n if len(A) == 0:\n A.append(x)\n elif i > 0:\n if x <= A[i-1]:\n A.insert(i-1, x)\n else:\n A[i-1] = x\n elif x... | ['Runtime Error', 'Accepted'] | ['s817155144', 's749532094'] | [3064.0, 7284.0] | [17.0, 577.0] | [387, 227] |
p02973 | u486065927 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['def se(c, x, h, l):\n if h == l:\n return l\n t = (h+l)//2\n if c[t] < x:\n a = se(c,x,h,t)\n else:\n a = se(c,x,t,h)\n return a\n \n \nimport numpy as np\nn = int(input())\na = [int(input()) for i in range(n)]\nc = [a[-1]]\nif len(np.unique(a)) == 1:\n print(len(a))\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s368891995', 's654968985', 's294891506'] | [22352.0, 22436.0, 20088.0] | [2109.0, 2108.0, 621.0] | [448, 324, 515] |
p02973 | u500297289 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\n\nN = int(input())\nA = [int(input()) for _ in range(N)]\n\nans = [A[0]]\nl = 1\n\nfor i in range(1, N):\n n = bisect.bisect_left(ans, A[i])\n if A[i] >= ans[-1]:\n ans.append(A[i])\n else:\n ans[n] = A[i]\n\nprint(len(ans))\n', 'import bisect\n\nN = int(input())\nA = [int(input(... | ['Wrong Answer', 'Accepted'] | ['s009265326', 's319176847'] | [7832.0, 7840.0] | [236.0, 238.0] | [248, 255] |
p02973 | u522293645 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\n# from collections import deque\n# from collections import Counter\n\n# from fractions import Fraction\n# from math import gcd # <Python3.5\n# from math import sqrt\n \nn = int(input())\nli = [int(input()) for i in range(n)]\nli = [-x for x in li]\n\nX = []\nX.append(li[0])\n\nfor i in range(1,n):\n ... | ['Wrong Answer', 'Accepted'] | ['s069169391', 's733001331'] | [11048.0, 11052.0] | [257.0, 248.0] | [517, 515] |
p02973 | u525227429 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['N = int(input())\nA = []\nfor _ in range(N):\n a = int(input())\n A.append(a)\n\ncheck = [False for _ in range(N)]\ncnt = 0\nwhile len(A) > 0:\n A0 = min(A)\n A.pop(A.index(A0))\n cnt += 1\n i = 0\n while i < len(A):\n if A[i] > A0:\n A.pop(i)\n else:\n i += 1\nprint(cnt)', 'N = int(input())\nA... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s583127842', 's900840321', 's664086376'] | [7848.0, 7068.0, 8060.0] | [2104.0, 230.0, 291.0] | [277, 203, 295] |
p02973 | u533232830 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['n = int(input())\na = [int(input()) for _ in range(n)]\nl = []\n\nfor i in range(n):\n if i == 0:\n l.append([a[i]])\n for j in range(len(l)):\n if l[j][-1] < a[i]:\n l[j].append(a[i])\n break\n else:\n l.append([a[i]])\nprint(len(l))', 'from bisect import bisect_le... | ['Wrong Answer', 'Accepted'] | ['s897973895', 's430692360'] | [7588.0, 13948.0] | [2104.0, 416.0] | [273, 252] |
p02973 | u533885955 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['\nimport bisect\n\nN = int(input())\nA = [int(input()) for i in range(N)]\nB = []\nfor i in range(N):\n if len(B) == 0:\n B.append(A[i])\n else:\n if B[0] >= A[i]:\n B.append(A[i])\n else:\n index = bisect.bisect_left(B,A[i])-1\n B[index] = A[i]\n B.sort(... | ['Wrong Answer', 'Accepted'] | ['s176981983', 's406284203'] | [7196.0, 7884.0] | [2104.0, 241.0] | [328, 327] |
p02973 | u554096168 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['N = int(input())\n\nA = []\n\nfor _ in range(N):\n A.append(int(input()))\n\ncolored = [False] * N\ngoal = [True] * N\n\ncolor_num = 0\n\nwhile colored != goal:\n start = colored.index(False)\n base = A[start]\n colored[start] = True\n\n print("check from {}".format(start))\n\n for i in range(start+... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s441864327', 's816060441', 's051511922'] | [8608.0, 7964.0, 7848.0] | [2104.0, 248.0, 241.0] | [467, 363, 279] |
p02973 | u611562941 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['n = int(input())\nl = [int(input()) for i in range(n)]\n#print(n,l)\n\nL = 0\ncnt = 0\nfor i in range(n):\n if l[i] >= l[i+1]:\n cnt += 1\n else:\n cnt = 0\n if L <= cnt:\n L = cnt\nprint(L)', 'import bisect\n\nN = int(input())\nA = [10**10 - int(input()) for i in range(N)]\nINF = 10**12... | ['Runtime Error', 'Accepted'] | ['s193498276', 's895567420'] | [7072.0, 7848.0] | [198.0, 237.0] | [207, 251] |
p02973 | u645250356 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ["from collections import Counter,defaultdict,deque\nfrom heapq import heappop,heappush,heapify\nimport sys,bisect,math,itertools,fractions,pprint\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\nmod2 = 998244353\nINF = float('inf')\ndef inp(): return int(sys.stdin.readline())\ndef inpl(): return list(map(int, sys.stdin.r... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s194787904', 's948077890', 's409549222'] | [9900.0, 9944.0, 9728.0] | [427.0, 441.0, 437.0] | [619, 621, 615] |
p02973 | u664373116 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['\ndef desc_bin(a, x, lo=0, hi=None):\n """Insert item x in list a, and keep it reverse-sorted assuming a\n is reverse-sorted.\n\n If x is already in a, insert it to the right of the rightmost x.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n """\n ... | ['Runtime Error', 'Accepted'] | ['s688407912', 's201223803'] | [134388.0, 7172.0] | [2104.0, 537.0] | [747, 748] |
p02973 | u672220554 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['\ndef bisect_desc(a,x):\n r = len(a)\n if r == 0:\n return 0\n l = 0\n while l != r:\n f = (l+r)//2\n if a[f] >= x:\n l = f+1\n else:\n r = f\n return l', 'n=int(input())\na=[int(input()) for _ in range(n)]\n\nq=[]\n\ndef bisect_desc(a,x):\n r = len(... | ['Wrong Answer', 'Accepted'] | ['s586471521', 's201355332'] | [2940.0, 7808.0] | [17.0, 489.0] | [205, 385] |
p02973 | u674959776 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from collections import deque\n\nn=int(input())\na=[]\nfor i in range(n):\n A=int(input())\n a.append(A)\nl=deque([a[0]])\nfor i in range(1,n):\n if l[0]>=a[i]:\n l.appendleft(a[i])\n elif l[-1]<=a[i]:\n l.append(a[i])\n else:\n p=0\n q=len(l)-1\n while q-p!=1:\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s312373224', 's871078544', 's691686398'] | [8060.0, 7072.0, 8060.0] | [717.0, 189.0, 685.0] | [434, 402, 429] |
p02973 | u677267454 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\nfrom collections import deque\n\nN = int(input())\nA = []\nfor i in range(N):\n A.append(int(input()))\n\nans = deque([A[0]])\nfor i in range(1, N):\n index = bisect.bisect_left(ans, A[i])\n if index > 0:\n ans[index - 1] = A[i]\n else:\n ans = [A[i]] + ans\n\nprint(len(ans))\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s124377434', 's126469736', 's703528775', 's844675337', 's172833838'] | [7428.0, 7428.0, 7588.0, 7892.0, 8060.0] | [218.0, 223.0, 2104.0, 232.0, 540.0] | [302, 304, 262, 247, 304] |
p02973 | u685263709 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\nN = int(input())\nA = [int(input()) for i in range(N)]\nA = [-a for a in A]\n\ndp = []\nfor a in A:\n i = bisect.bisect_right(dp, a)\n if i >= len(dp):\n dp.append(a)\n else:\n dp[i] = a\n\nprint(N-len(dp))', 'import bisect\nN = int(input())\nA = [-int(input()) for i in range(N)]... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s120324304', 's480588062', 's069797337'] | [11052.0, 7836.0, 7836.0] | [238.0, 239.0, 242.0] | [231, 212, 211] |
p02973 | u690536347 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from collections import defaultdict\nfrom bisect import bisect_left\n\nN = int(input())\nd = defaultdict(list)\n\nfor i in range(N):\n v = int(input())\n d[v].append(i)\n\nkeys = sorted(d.keys())\ns = d[keys[0]]\n\nfor k in keys[1:]:\n used = set()\n for i in d[k]:\n j = bisect_left(s, i)\n ... | ['Wrong Answer', 'Accepted'] | ['s778803641', 's797022120'] | [30416.0, 8828.0] | [2106.0, 512.0] | [550, 271] |
p02973 | u692746605 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\n\nn=int(input())\na=[int(input()) for x in range(n)]\nc=[]\n\nc.append(a[0])\n\nfor i in range(1,n):\n j=bisect.bisect_right(c,a[i])\n if c[j-1]<a[i]:\n c[j-1]=a[i]\n else:\n c.insert(j,a[i])\n print(c)\nprint(len(c))\n', 'mport bisect\n\nN=int(input())\nA=[int(input()) for i in range(N)]\n\n... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s043114850', 's104908757', 's751262786', 's242009990'] | [138288.0, 2940.0, 7196.0, 7836.0] | [1934.0, 17.0, 174.0, 242.0] | [228, 175, 180, 189] |
p02973 | u693723949 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['N = int(input())\narr = []\nfor i in range(N):\n arr.append(int(input()))\nc = 0\ncol_min = []\n\nfor i in range(N-1, -1, -1):\n if i == N-1:\n col_min.append(arr[i])\n c += 1\n else:\n check = 0\n for k, v in enumerate(col_min):\n if v > arr[i]\n \tcol_min[k] = arr[i]\n check = 1\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s549586021', 's572455962', 's642050679', 's785848340'] | [2940.0, 7072.0, 2940.0, 8620.0] | [17.0, 2104.0, 17.0, 252.0] | [389, 241, 364, 187] |
p02973 | u698176039 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\nimport sys\ninput = sys.stdin.readline\n\nN = int(input())\nA = [-1*int(input()) for _ in range(N)]\n\nmaxims = [A[0]]\nans = 1\nminim = A[0]\nfor a in A[1:]:\n if maxims[-1] < a:\n idx = bisect.bisect(maxims,a)\n maxims[idx] = a\n else:\n maxims.append(a)\n ans += 1\n... | ['Runtime Error', 'Accepted'] | ['s571101902', 's537783567'] | [8600.0, 8600.0] | [86.0, 121.0] | [331, 318] |
p02973 | u709304134 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\nimport sys\ninput = sys.stdin.readline\nN = int(input())\nA = []\nfor n in range(N):\n A.append(int(input()))\nA = A[::-1]\nINF = int(1e+9 + 10)\nlis = [INF]* (N)\nfor n in range(N):\n i = bisect.bisect(lis, A[n]) \n lis[i] = A[n]\n #print (lis)\nprint (bisect.bisect_left(lis, INF)) a', ... | ['Runtime Error', 'Accepted'] | ['s551360243', 's372802666'] | [3064.0, 7840.0] | [17.0, 135.0] | [301, 281] |
p02973 | u712822150 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import sys\nimport bisect\nimport collections\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n n = int(input())\n la = [int(input()) for _ in range(n)]\n result = collections.deque()\n for a in la:\n idx = bisect.bisect_left(result, a)\n if idx == 0:\n ... | ['Wrong Answer', 'Accepted'] | ['s006646836', 's896598668'] | [12752.0, 8052.0] | [429.0, 410.0] | [421, 403] |
p02973 | u771007149 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['#E\nfrom collections import deque\nimport bisecit\nn = int(input())\na = [int(input()) for _ in range(n)]\nresult = deque()\n\nfor i in a:\n idx = bisect.bisect_left(result,i)\n if idx == 0:\n result.appendleft(i)\n \n else:\n result[idx-1] = i\n \nprint(len(result))', '#E\nfrom c... | ['Runtime Error', 'Accepted'] | ['s674906798', 's066016833'] | [3316.0, 8060.0] | [21.0, 512.0] | [289, 297] |
p02973 | u798129018 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['N = int(input())\na =[0]*(N)\nfor i in range(N):\n a[i] = int(input())\ncolor = [0]*N\ncolor[0]=a[0]\ncnt = a[0]\nans = 1\nfor i in range(1,N):\n if cnt <= a[i] and a[i] <= color[ans-1]:\n color[ans] = a[i]\n cnt = a[i]\n ans +=1\n elif cnt <= a[i] and a[i] > color[ans-1]:\n color[a... | ['Wrong Answer', 'Accepted'] | ['s496290753', 's601064016'] | [8308.0, 7708.0] | [230.0, 271.0] | [375, 446] |
p02973 | u811817592 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['# -*- coding: utf-8 -*-\nN = int(input())\na_list = []\nfor i in range(N):\n a_list.append(int(input()))\ncolor_counter = 0\nfor i in range(N):\n color_counter += 1\n compare_a = a_list[0]\n next_a_list = []\n for i in range(N):\n if compare_a < a_list[i]:\n compare_a = a_list[i]\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s382177444', 's858952191', 's751785060'] | [9632.0, 7840.0, 11032.0] | [2104.0, 2104.0, 241.0] | [461, 443, 365] |
p02973 | u813102292 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from bisect import bisect as bl\n\nN = int(input())\nA = []\nfor i in range(N):\n A.append(int(input()))\n\ndef lds(X: list):\n L = [-X[0]]\n for x in X[1:]:\n if L[-1] <= -x:\n L.append(-x)\n else:\n L[bl(L, -x)] = -x\n return L\n\nprint(lds(A))', 'from bisect import b... | ['Wrong Answer', 'Accepted'] | ['s484042857', 's021831626'] | [15576.0, 11880.0] | [240.0, 226.0] | [278, 283] |
p02973 | u864013199 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['\nfrom bisect import bisect\nn = int(input())\nA = [int(input()) for _ in range(n)]\ndp = [1]\nfor a in A:\n a *= -1\n i = bisect(dp,a) \n print(dp)\n if i < len(dp): \n dp[i] = a \n else:\n dp.append(a) \n print(dp)\n\nprint(len(dp))', "\nimport sys\ninput = sys.stdin.rea... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s127848903', 's142934166', 's571581768'] | [138264.0, 11868.0, 11036.0] | [1769.0, 172.0, 114.0] | [477, 678, 674] |
p02973 | u865741247 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['N = int(input())\nnums = [int(input()) for _ in range(N)]\nans = 0\nnums_sorted = nums[:]\nnums_sorted = list(set(nums_sorted))\nnums_sorted.sort(reverse=True)\ndi = {}\n\n\n\n\n\nfor i in range(N-1):\n if nums[i] > nums[i+1]:\n ans += 1\n\nnums_l = len(nums)\nnums_s = len(list(set(nums)) )\nans += nums_l -... | ['Runtime Error', 'Accepted'] | ['s627240509', 's821368853'] | [14480.0, 8948.0] | [244.0, 592.0] | [355, 264] |
p02973 | u887080340 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\nN = int(input())\nA = [-int(input()) for _ in range(N)]\ntmp = [A[0]]\nfor i in A[1:N]:\n index = bisect.bisect_left(tmp, i)\n if index == 0:\n tmp.append(i)\n else:\n tmp[index-1] = i\n\nprint(len(tmp))\n', 'import bisect\nN = int(input())\nA = [-int(input()) for _ in range(N)]\... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s365340325', 's523746580', 's785803108', 's453419025'] | [8604.0, 8360.0, 8528.0, 8604.0] | [244.0, 237.0, 2104.0, 250.0] | [231, 226, 294, 231] |
p02973 | u911575040 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['n=int(input())\nimport bisect\n\na=[int(input()) for _ in range(n)]\nx=[a[0]]\nfor i in a[1:]:\n y=bisect.bisect(x,i)\n if y==len(x):x.append(i)\n else:x[y]=i\nprint(len(x))', "from bisect import bisect_right\nN = int(input())\nA = []\nfor i in range(N):\n A.append(-int(input()))\nINF = float('inf')\nD = [INF] ... | ['Wrong Answer', 'Accepted'] | ['s028505978', 's311043639'] | [8612.0, 7840.0] | [237.0, 275.0] | [167, 224] |
p02973 | u919730120 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from bisect import bisect_left\nimport heapq\nn=int(input())\nl=[]\nl.append(int(input()))\nheapq.heapify(l)\nfor i in range(n-1):\n a=int(input())\n x=bisect_left(l,a)\n if x==0:\n heapq.heappush(l,a)\n else:\n l[x-1]=a\n print(l)\nprint(len(l))', "from bisect import bisect_left,bisect_r... | ['Runtime Error', 'Accepted'] | ['s871777572', 's409409172'] | [140900.0, 14492.0] | [1465.0, 186.0] | [261, 191] |
p02973 | u921066423 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\n\nn = input()\na = []\nn = int(n)\n\nfor i in range(n):\n a.append(int(input()))\n\n\nt = []\n\nfor i in a:\n \n \n if len(t) > 0 and i < t[0]:\n t.insert(0, i)\n \n idx = bisect.bisect_left(t, i)\n t[idx-1] = i\n # print(t)\n\nprint(len(t))\n', 'import bisect\n\nn = int(... | ['Runtime Error', 'Accepted'] | ['s256758001', 's109232539'] | [7072.0, 8604.0] | [186.0, 243.0] | [457, 424] |
p02973 | u921773161 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['print(1)', '#%%\nimport bisect\n\nn = int(input())\na = [0] * n\nfor i in range(n):\n a[i] = int(input())\n\nans_list = [-1] * n\nfor i in range(n):\n tmp = bisect.bisect_left(ans_list, a[i])\n #print(tmp)\n if tmp == 0:\n ans_list.insert(0, a[i])\n else:\n ans_list[tmp-1] = a[i]\n #pr... | ['Wrong Answer', 'Accepted'] | ['s948502295', 's234149809'] | [2940.0, 7796.0] | [17.0, 266.0] | [8, 392] |
p02973 | u932465688 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from collections import deque\n\nn = int(input())\nL = deque([int(input())])\nfor i in range(1,n):\n t = int(input())\n a = L.popleft()\n if t <= a:\n L.append(t)\n L.append(a)\n else:\n L.append(t)\nprint(len(L))\n', 'from collections import deque\nimport bisect\nn = int(input())\nL ... | ['Wrong Answer', 'Accepted'] | ['s849563863', 's074327316'] | [7284.0, 7412.0] | [224.0, 582.0] | [235, 244] |
p02973 | u937642029 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['import bisect\ndef LIS(a):\n lis = [a[0]]\n for i in range(len(a)):\n if i != 0 and a[i] >= lis[-1]:\n lis.append(a[i])\n else:\n index = bisect.bisect_right(lis,a[i])\n lis[index] = a[i]\n return len(lis)\n\ndef main():\n n = int(input())\n a = [-int(inpu... | ['Runtime Error', 'Accepted'] | ['s840834897', 's005876876'] | [7072.0, 8052.0] | [179.0, 505.0] | [385, 419] |
p02973 | u945228737 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ["\n\nimport bisect\n\n\ndef solve():\n N = int(input())\n A = [int(input()) for _ in range(N)]\n color_list = [A[-1]]\n for a in reversed(A[:-1]):\n \n c = bisect.bisect_left(color_list, a + 1) \n print(c)\n if c == len(color_list):\n color_list.append(a)\n el... | ['Wrong Answer', 'Accepted'] | ['s931438984', 's740512292'] | [9592.0, 9116.0] | [285.0, 218.0] | [520, 501] |
p02973 | u946996108 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['mod = 10 ** 9 + 7\nmod2 = 2**61+1\nfrom collections import deque\nimport heapq\nfrom bisect import bisect_left, insort_left, bisect_right\n\ndef iip(listed):\n ret = [int(i) for i in input().split()]\n if len(ret) == 1 and not listed:\n return ret[0]\n return ret\n\ndef iip_ord():\n return [ord(i) ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s170441535', 's197092604', 's122089579'] | [8196.0, 8196.0, 11644.0] | [348.0, 334.0, 348.0] | [3117, 3137, 3184] |
p02973 | u983918956 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['N = int(input())\nA = [int(input()) for _ in range(N)]\n\nif N == 1:\n print(1)\n exit()\n\nif A[0] < A[1]:\n ans = 1\n m = A[0]\n M = A[1]\nelif A[0] >= A[1]:\n ans = 2\n m = A[1]\n M = A[0]\n\nfor a in A[2:]:\n print(m,M)\n if a <= m:\n ans += 1\n m = a\n elif m < a <=... | ['Wrong Answer', 'Accepted'] | ['s508344311', 's740864206'] | [10044.0, 8608.0] | [313.0, 253.0] | [356, 326] |
p02973 | u983943108 | 2,000 | 1,048,576 | You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied: * If A_i and A_j (i < j) are painted with the same color, A_i < A_j. Find the minimum number of col... | ['from bisect import bisect\nn = int(input())\na = [int(input()) for _ in range(n)]\nupdate_list=[11 for _ in range(n+1)]\nfor old_element in range(n):\n update_position=bisect(update_list,-a[old_element])\n update_list[update_position]=-a[old_element]\n\ncounter=1\nfor sign in update_list:\n if sign>0:\n ... | ['Wrong Answer', 'Accepted'] | ['s924749876', 's806783101'] | [11036.0, 11036.0] | [248.0, 257.0] | [335, 307] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.