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
p03042
u864202285
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['S = input()\nfirst = int(S[:2])\nlast = int(S[2:])\nprint(first, last)\n\nis_month_first = False\nis_month_last = False\n\nif first <= 12 and first > 0:\n is_month_first = True\nif last <= 12 and last > 0:\n is_month_last = True\n\nif is_month_first and is_month_last:\n print("AMBIGUOUS")\nelif not is_month_...
['Wrong Answer', 'Accepted']
['s496552479', 's350173744']
[3064.0, 3064.0]
[17.0, 17.0]
[430, 411]
p03042
u864276028
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['S = input()\nS1 = int(s[:2])\nS2 = int(s[2:])\n\nif 1<=s1<=12 and 1<=s2<=12:\n print("AMBIGUOUS")\nelif 0<=s1<=99 and 1<=s2<=12:\n print("YYMM")\nelif 1<=s1<=12 and 0<=s2<=99:\n print("MMYY")\nelse:\n print("NA")', 'S = input()\nS1 = int(S[:2])\nS2 = int(S[2:])\n\nif 1 <= S1 <= 12 and 1 <= S2 <= 12:\n print("AMB...
['Runtime Error', 'Accepted']
['s639061226', 's808265488']
[3060.0, 3064.0]
[17.0, 17.0]
[205, 229]
p03042
u867848444
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["s=input()\nl=s[0]+s[1]\nm=s[2]+s[3]\nmonth=['01','02','03','04','05','06','07','08','09','10','11','12']\nif month.count(l)==1 and month.count(m)==1:\n print('AMBIGOUS')\nelif month.count(l)==1 and month.count(m)==0:\n print('MMYY')\nelif month.count(m)==1 and month.count(m)==0:\n print('YYMM')\nelse:\n p...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s638428393', 's786919125', 's901748276']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[317, 317, 318]
p03042
u868344991
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['# -*- coding: utf-8 -*-\n\n\n\ndef Mcheck(n):\n if(0<n<13):\n return 0\n else:\n return 1\n \ndef Ycheck(n):\n if(n==0):\n return 1\n else:\n return 0\n\n\nS=input()\nf=int(S[0])*10+int(S[1])\ns=int(S[2])*10+int(S[3])\n\nif(Mcheck(f)==0):\n if(Mcheck(s)==0):\n prin...
['Wrong Answer', 'Accepted']
['s087236017', 's339072245']
[3064.0, 3060.0]
[17.0, 17.0]
[487, 330]
p03042
u870518235
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['S = input()\nf = int(S[0]+S[1])\nb = int(S[2]+S[3])\n\ndef judge(int):\n if 1 <= int <= 12\n return 0\n else:\n return 1\nref = [judge(f), judge(b)]\n\nif ref == [1, 1]:\n print("NA")\nelif ref == [0, 1]:\n print("MMYY")\nelif ref == [1, 0]:\n print("YYMM")\nelse:\n print("AMBIGUOUS")\...
['Runtime Error', 'Accepted']
['s722142352', 's433994646']
[8872.0, 8920.0]
[24.0, 28.0]
[300, 301]
p03042
u873134970
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['S = input()\nans = [0, 0]\nif check(S[0], S[1]):\n ans[0] += 1\nif check(S[2], S[3]):\n ans[1] += 1\n\nif ans == [0, 0]:\n print("NA")\nelif ans == [0, 1]:\n print("YYMM")\nelif ans == [1, 0]:\n print("MMYY")\nelif ans == [1, 1]:\n print("AMBIGIOUS")', 'def check(M_1, M_2):\n M_1 = int(M_1)\n ...
['Runtime Error', 'Accepted']
['s880789015', 's374184710']
[3064.0, 3064.0]
[17.0, 17.0]
[254, 413]
p03042
u875028418
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['a=int(input())\nif(0<a%100<13):\n if(0<a//100<13):\n print("AMBIGUOUS")\n else:\n print("MMYY")\n else:\n if(0<a//100<13):\n print("YYMM")\n else:\n print("NA")', 'a=int(input())\nif(0<a%100<13):\n if(0<a//100<13):\n print("AMBIGUOUS")\n else:\n print("MMYY")\nelse:\n if(0<a//100<1...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s084749976', 's190158952', 's675791024']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0]
[175, 174, 174]
p03042
u877220920
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['def ismonth(month):\n return 0 < month < 13\n\n\nS = input()\n\nformer = int(S[:2])\nlatter = int(S[2:])\n\nif not (ismonth(former) and ismonth(latter)):\n ans = "NA"\n\nelif ismonth(former) and ismonth(latter):\n ans = "AMBIGUOUS"\n\nelif ismonth(former):\n ans = "MMYY"\n\nelif ismonth(latter):\n ans ...
['Wrong Answer', 'Accepted']
['s012950444', 's823373113']
[3064.0, 3312.0]
[17.0, 18.0]
[319, 387]
p03042
u896206464
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['s = input()\nf = int(s[0:2])\nl = int(s[2:4])\n\nstate = {"yymm": False, "mmyy": False}\n\nif 0<= f <= 99:\n if 1<= l <= 12:\n state["yymm"] = True\n\nif 0<= l <= 99:\n if 1<= f <= 12:\n state["mmyy"] = True\n\nif state["yymm"] == True and state["mmyy"] == True:\n print("AMBIGUOUS")\nelif state...
['Wrong Answer', 'Accepted']
['s114595154', 's254237723']
[3064.0, 3188.0]
[17.0, 18.0]
[459, 207]
p03042
u900688325
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["string = input()\n\nmoji_list = []\nfor i in range(4):\n moji_list[i] = string[i]\n\nue = ''\nsita = ''\nfor j in range(2):\n ue += moji_list[i]\n sita += moji_list[i+2]\n\nint_ue = int(ue)\nint_sita = int(sita)\n\nsw_ue = 0\nsw_sita = 0\nif 1<=int_ue and int_ue<=12:\n sw_ue += 1\n\nif 1<=int_sita and int...
['Runtime Error', 'Accepted']
['s038214971', 's124875190']
[3064.0, 3064.0]
[17.0, 17.0]
[535, 554]
p03042
u901598613
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['n=input():\nf=n[:2]\nl=n[2:]\nif (f=="00" and l=="00") or (int(f)>12 and int(l)>12):\n print("NA")\nelif int(f)>12 or f=="00":\n print("YYMM")\nelif int(l)>12 l=="00":\n print("MMYY")\nelse:\n print("AMBIGUOUS")', 'n=input()\nf=n[:2]\nl=n[2:]\nif (f=="00" and l=="00") or (int(f)>12 and int(l)>12):\n pr...
['Runtime Error', 'Runtime Error', 'Accepted']
['s573101486', 's765968696', 's421466653']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0]
[213, 212, 270]
p03042
u901850884
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['#!/usr/bin/env python3\n\nn=input()\n\nn1,n2=int(n[:2]),int(n[2:])\nif n1>12 and n2>12 or n1==0 or n2==0:\n print("Na")\nelif n1<=12 and n2<=12:\n print("AMBIGUOUS")\nelif n1!=0 or n1<=12:\n print("MMYY")\nelif n2!=0 or n2<=12:\n print("YYMM")\nelse:\n print("errer")\n\n', 'n=input()\n\nn1,n2=int(n[:2]...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s562101099', 's595050833', 's696347905', 's581701801']
[9000.0, 9088.0, 9044.0, 9164.0]
[30.0, 25.0, 22.0, 25.0]
[270, 270, 267, 275]
p03042
u902151549
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['using System;\nusing static System.Console;\nusing System.Text;\nusing System.Linq;\nusing static System.Math;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Diagnostics;\n\nclass Program\n{\n public static cp alg;\n public static int[] A;\n //public static ...
['Runtime Error', 'Accepted']
['s764856308', 's436586079']
[2940.0, 3184.0]
[19.0, 19.0]
[4280, 508]
p03042
u904943473
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["S = input()\n\na = S[:2]\nb = S[2:]\n\nprint(a,int(b))\n\nif (int(a) > 12 and int(b) <= 12 and int(b) > 0):\n print('YYMM')\nelif (int(b) > 12 and int(a) <= 12 and int(a) > 0):\n print('MMYY')\nelif (int(a) <= 12 and int(a) > 0 and int(b) <= 12 and int(b) > 0):\n print('AMBIGUOUS')\nelse:\n print('NA')\n", "S = i...
['Wrong Answer', 'Accepted']
['s282521499', 's314122431']
[3060.0, 3064.0]
[17.0, 17.0]
[294, 417]
p03042
u907997483
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['S = input()\n\nA = 10 * int(S[0]) + int(S[1])\nB = 10 * int(S[2]) + int(S[3])\n\nprint(A)\nprint(B)\n\nflag_YYMM = 0\nflag_MMYY = 0\n\nif 1 <= A and A <= 12 and 1 <= B : \n flag_MMYY += 1\nif 1 <= B and B <= 12 and 1 <= A : \n flag_YYMM += 1\n \nif flag_YYMM == 0 and flag_MMYY == 0 : \n print("NA")\nelif ...
['Wrong Answer', 'Accepted']
['s341674223', 's069859747']
[3064.0, 3064.0]
[17.0, 17.0]
[479, 459]
p03042
u918123058
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["s=int(input())\nk=s%100\nl=(s-k)/100\nk=int(k)\nl=int(l)\nif k<=12 & k>=1:\n if l>=1 and l<=12:\n ans='ANBIGUOUS'\n else:\n ans='MMYY'\nelif l>=1 and l<=12:\n ans='YYMM'\nelse:\n ans='NA'\nprint(ans)\n \n ", "s=int(input())\nk=s%100\nl=(s-k)/100\nk=int(k)\nl=int(l)\nif k<=12 and k>...
['Wrong Answer', 'Accepted']
['s952736730', 's434705067']
[3060.0, 3064.0]
[17.0, 17.0]
[225, 213]
p03042
u919017918
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["S = input()\n\nans1 = 'YYMM'\nans2 = 'MMYY'\nans3 = 'AMBIGUOUS'\nans4 = 'NA'\n\ns1 = int(S[:2])\ns2 = int(S[2:])\n\nprint(s1, s2)\n\nif 0 < s1 < 13 and 0 < s2 < 13:\n print(ans3) \nelif 0 < s1 < 13:\n print(ans2) \nelif 0 < s2 < 13:\n print(ans1) \nelse:\n print(ans4)", "S = input()\n\nans1 = 'YYMM'\nans2 = 'MMYY...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s201572934', 's657740301', 's493490163']
[3064.0, 3064.0, 3060.0]
[18.0, 18.0, 17.0]
[253, 253, 238]
p03042
u919633157
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["s=input()\naa=int(s[:2])\nbb=int(s[3:])\nif aa>12 and bb==0 or aa==0 and bb>12: ans='NA'\nelif 0<aa<=12 and 0<bb<=12: ans='AMBIGUOUS'\nelif aa>12 or aa==0 and 0<bb<=12: ans='YYMM'\nelse :ans='MMYY'\nprint(ans)1", "s=input()\naa=int(s[:2])\nbb=int(s[2:])\nif 0<aa<=12 and 0<bb<=12: ans='AMBIGUOUS'\nelif 0<bb<=12: ans='...
['Runtime Error', 'Accepted']
['s826934182', 's136427580']
[2940.0, 3060.0]
[17.0, 17.0]
[203, 157]
p03042
u925712467
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['try:\n s1=(input(\'\'))\n if len(s1)>=4:\n raise ValueError\n \n check=list((s1))\n assert bool(int(check[0]+check[1])<=12) != bool(int(check[2]+check[3])<=12)\n if int(check[0]+check[1])<=12:\n print("MMYY")\n elif int(check[2]+check[3])<=12:\n print("YYMM")\nexcept Assertio...
['Runtime Error', 'Accepted']
['s555062433', 's781381787']
[9144.0, 9196.0]
[23.0, 26.0]
[437, 469]
p03042
u927357863
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["# -*- coding: utf-8 -*-\nS = list(input())\nFF = ''\nRR = ''\nJ = [0] * 2\n\nfor st in S[0],S[1]:\n\tFF += st\n\nfor st in S[1],S[3]:\n\tRR += st\n\nif 1 <= int(FF) <= 12:\n\tJ[0] = 1\nelse:\n\tJ[0] = 0\n\nif 1 <= int(RR) <= 12:\n\tJ[1] = 1\nelse:\n\tJ[1] = 0\n\nif J[0] == 0 and J[1] == 0:\n\tprint('NA')\nelif J[0] =...
['Wrong Answer', 'Accepted']
['s036087230', 's711980691']
[3064.0, 3064.0]
[17.0, 17.0]
[391, 391]
p03042
u931118906
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["s=list(map(int,input()))\na=10*s[0]+s[1]\nb=10*s[2]+s[3]\nif a<=12 and b<=12:\n print('AMBIGUOUS')\nelif a+b==0:\n print('NA')\nelif a>12 and b>12:\n print('NA')\nelif a==0,b>12:\n print('NA')\nelif b==0.a>12:\n print('NA')\nelif 0<a<=12 and 12<b:\n print('MMYY')\nelif 0<b<=12 and 12<a:\n print('...
['Runtime Error', 'Accepted']
['s232287823', 's014355521']
[2940.0, 3064.0]
[17.0, 17.0]
[391, 368]
p03042
u932868243
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["a,b,c,d=input()\nx=int(a+b)\ny=int(c+d)\nif 0<=x<=12 and 1<=y<=12:\n print('AMBIGUOUS')\nelif 1<=x<=12 and 0<=y=12:\n print('AMBIGUOUS')\nelif 0<=x<=99 and 1<=y<=12:\n print('YYMM')\nelif 1<=x<=12 and 0<=y<=99:\n print('MMYY')\nelse:\n print('NA')", "a,b,c,d=input()\nx=int(a+b)\ny=int(c+d)\nif 1<=x<=12 and 1<=y<...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s177877673', 's633495990', 's755242948', 's758567106', 's987499573', 's422193866']
[2940.0, 3060.0, 3064.0, 3060.0, 3060.0, 3060.0]
[17.0, 18.0, 18.0, 17.0, 18.0, 17.0]
[240, 191, 273, 241, 249, 192]
p03042
u937495656
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["S = input()\n\nformar = int(S[:2])\nlatter = int(S[2:])\n\nif has_month_potential(formar) and not has_month_potential(latter):\n print('MMYY')\nelif not has_month_potential(formar) and has_month_potential(latter):\n print('YYMM')\nelif has_month_potential(formar) and has_month_potential(latter):\n print('AMB...
['Runtime Error', 'Accepted']
['s659214933', 's336406780']
[3064.0, 3060.0]
[17.0, 17.0]
[406, 471]
p03042
u938486382
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["s = input()\nh = s[:2]\nt = s[2:]\nprint(h, t)\ndef montheable(p):\n return '00' < p < '13'\nif montheable(h) and montheable(t):\n print('AMBIGUOUS')\nelif montheable(h):\n print('MMYY')\nelif montheable(t):\n print('YYMM')\nelse:\n print('NA')", "s = input()\nh = s[:2]\nt = s[2:]\ndef montheable(p):\n...
['Wrong Answer', 'Accepted']
['s139775161', 's765057054']
[3060.0, 2940.0]
[17.0, 17.0]
[246, 234]
p03042
u939585142
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['S = input()\n\nif int(S[:1]) <= 12 and int(S[:1]) >= 1:\n if int(S[2:]) <= 12 and int(S[2:]) >= 1:\n print("AMBIGUOUS")\n else:\n print("MMYY")\nelif int(S[:1]) > 12:\n if int(S[2:]) <= 12 and int(S[2:]) >= 1:\n print("YYMM")\n else:\n print("NA")\nelif int(S[:1]) == 0:\n if int(S[2:]) < 12 and int(S...
['Wrong Answer', 'Accepted']
['s157645343', 's364725780']
[3064.0, 2940.0]
[17.0, 17.0]
[362, 232]
p03042
u959225525
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['s=input()\ns1=int(s[0:2])\ns2=int(s[2:4])\n\nif 0<s1<13 and 0<s2<13:\n print("AMBIGUOUS")\nelif 0<s1<13:\n print("MMYY")\nelif 0<s2<13:\n print("YYMM")\nelse:\n print("NA")\n\nprint(s1,s2)', 's=input()\ns1=int(s[0:2])\ns2=int(s[2:4])\n\nif 0<s1<13 and 0<s2<13:\n print("AMBIGUOUS")\nelif 0<s1<13:\n p...
['Wrong Answer', 'Accepted']
['s991387697', 's416773997']
[3060.0, 3060.0]
[17.0, 17.0]
[187, 173]
p03042
u970198631
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["NN = input()\nAA = int(NN[0:2])\nBB = int(NN[2:-1])\ncount1 = 0\ncount2 = 0\nif AA >12 or AA == 00:\n count1 +=1\nif BB >12 or BB == 00:\n count2 +=2\nif count1 == 0 and count2 == 0:\n print('AMBIGUOUS')\nelif count1 ==1 and count2 == 0:\n print('YYMM')\nelif count1 ==0 and count2 == 1:\n print('MMYY')\nelse:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s300032455', 's531686566', 's620324261']
[9140.0, 9208.0, 9136.0]
[24.0, 29.0, 30.0]
[316, 316, 315]
p03042
u970899068
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["s=int(input())\na=(s-s%1000)-(s%1000-s%100)\nb=s%100\nif a<=1200 and b<=12:\n print('AMBIGUOUS')\nelif a<=1200 and b>12:\n print('MMYY')\nelif a>12 and b<=12:\n print('YYMM')\nelif a>12 and B>12:\n print('NA')", "s=int(input())\na=(s-s%1000)+(s%1000-s%100)\nb=s%100\nif 100<=a<=1200 and 1<=b<=12:\n print('AMBIGUO...
['Runtime Error', 'Accepted']
['s866187939', 's450405350']
[3060.0, 3060.0]
[17.0, 17.0]
[203, 281]
p03042
u973240207
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["from collections import defaultdict, deque\nimport sys, heapq, bisect, math, itertools, string, queue, copy, time\nfrom fractions import gcd\nimport numpy as np\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nMOD = 10**9+7\nEPS = 10**-7\n\n\ns = input()\nif s[:2] == '00' or s[2:] == '00':\n print('NA')\n exi...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s421142260', 's922147196', 's604381889']
[15624.0, 14316.0, 3064.0]
[173.0, 176.0, 17.0]
[509, 505, 274]
p03042
u981758672
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["s = int(input())\nf = s/100\nl = s%100\nif 1 <= f and f <= 12:\n if 1 <= l and l <= 12:\n print('AMBIGUOUS')\n else:\n print('MMYY')\nelse:\n if 1 <= l and l <= 12:\n print('AMBIGUOUS')\n else:\n print('NA')", "s = int(input())\nf = s/100\nl = s%100\nif 1 <= f and f <= 12:\n ...
['Wrong Answer', 'Accepted']
['s603694055', 's181059367']
[9084.0, 8992.0]
[25.0, 29.0]
[235, 230]
p03042
u986219766
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["ym = int(input())\n \nym1 = int(ym/100)\nym2 = int(ym%100)\n\nprint(ym1,ym2)\n \nif ym1 >= 1 and ym1 <= 12 and ym2 >= 1 and ym2 <=12:\n print('AMBIGUOUS')\nelif ym2>=1 and ym2<=12:\n print('YYMM')\nelif ym1>=1 and ym1<=12:\n print('MMYY')\nelse:\n print('NA')\n", "ym = int(input())\n \nym1 = int(ym/100)\nym2 = in...
['Wrong Answer', 'Accepted']
['s899560182', 's707555973']
[2940.0, 3060.0]
[17.0, 17.0]
[250, 233]
p03042
u992910889
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
["S=list(input())\ndef main():\n while True:\n if int(S[0]+S[1])>12:\n if int(S[2]+S[3])==0:\n return 'NA'\n if int(S[2]+S[3])>12:\n return 'YYMM'\n else:\n return 'AMBIGUOUS'\n else:\n return 'MMYY'\n \...
['Wrong Answer', 'Accepted']
['s684021742', 's062347674']
[2940.0, 3060.0]
[17.0, 19.0]
[319, 341]
p03042
u993461026
2,000
1,048,576
You have a digit sequence S of length 4. You are wondering which of the following formats S is in: * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order * MMYY format: the two-digit representation of the month and the la...
['S = input().rstrip()\nS = input().rstrip()\nbe = int(S[:2])\nen = int(S[2:])\nflag_be = False\nflag_en = False\nanswer = ""\nif be <= 12 and be >= 1:\n flag_be = True\nif en <= 12 and en >= 1:\n flag_en = True\n\nif flag_be and flag_en:\n answer = "AMBIGUOUS"\nelif flag_be == True and flag_en == False:\n ...
['Runtime Error', 'Accepted']
['s376837704', 's997448295']
[3064.0, 3064.0]
[17.0, 17.0]
[419, 398]
p03043
u007504025
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['from decimal import *\ngetcontext().prec = 28\nli = input().split()\nn = int(li[0])\nk = int(li[1])\n\n\n\n\n\n\n\nanswer = 0\nfor i in range(n):\n dicenum = i + 1\n winline = dicenum\n x = 0\n while winline < k:\n x += 1\n winline = dicenum * (2**x)\n if dicenum == 1:\n first_x = ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s338764376', 's901484173', 's969971559']
[5460.0, 3064.0, 5204.0]
[97.0, 72.0, 93.0]
[640, 567, 664]
p03043
u010069411
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['N,K=map(int, input().split())\n#N,K=100000, 100000\n\nl=[]\nfor i in range(1,N+1):\n n=0\n while i =< K:\n i *= 2\n n+=1\n l.append(1/N * (1/2)**n)\n\nprint(str(sum(l))[:14])\n', 'N,K=map(int, input().split())\n#N,K=100000,5\n\nl=[]\nfor i in range(1,N+1):\n n=0\n while i < K:\n i ...
['Runtime Error', 'Accepted']
['s539237060', 's508568586']
[2940.0, 6296.0]
[17.0, 48.0]
[187, 181]
p03043
u027855659
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['input_num = input().split()\ndice_num = int(input_num[0])\nborder_socre = int(input_num[1])\nans_p = 0\n\nfor score in range(1,dice_num + 1):\n coin_counter = 0\n \n while score <= border_socre:\n score = score * 2\n coin_counter += 1\n ans_p += (1 / dice_num ) * (1/2 ) ** coin_counter\nprin...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s097678831', 's367623939', 's843640818', 's418866412']
[3060.0, 2940.0, 3852.0, 3060.0]
[44.0, 17.0, 64.0, 43.0]
[314, 286, 343, 326]
p03043
u111473084
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['import sys\nfrom operator import itemgetter\nimport math\n\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\ndef ii(): return int(input())\ndef mi(): return map(int, input().split())\ndef lmi(): return list(map(int, input().split()))\ndef lmif(n): return [list(map(int, input().split())) for _ in range(n)]\...
['Wrong Answer', 'Accepted']
['s818667351', 's911561251']
[9120.0, 9384.0]
[29.0, 37.0]
[735, 565]
p03043
u208983435
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
["# -*- coding: utf-8 -*-\nimport math\n\ndef main():\n N, K = map(int, input().split(' '))\n \n result = 1 / N * sum([math.pow(0.5, math.ceil(math.log2(K / n))) if n < K else 1.0 for n in range(1, N + 1)])\n print('{:f}'.format(result))\n\n\nif __name__ == '__main__':\n main()\n", "# -*- coding: utf-8 -...
['Wrong Answer', 'Accepted']
['s974638411', 's738982851']
[3864.0, 3864.0]
[25.0, 26.0]
[281, 284]
p03043
u212539610
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['import numpy as np\nfrom decimal import Decimal\n\nN, K = map(int, input().split())\n\n\nprob = []\nif N >= K:\n p_e = (1 / N) * (N - K + 1)\n for i in range(1, K):\n p_i = (1 / N) * ((1 / 2) ** (int(np.log2(K / i)) + 1))\n prob.append(p_i)\nelse:\n p_e = 0\n for i in range(1, N+1):\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s274557096', 's443843372', 's714756472', 's899524053', 's965232881', 's501453405']
[22160.0, 12508.0, 21520.0, 12508.0, 2940.0, 12508.0]
[321.0, 180.0, 350.0, 178.0, 17.0, 177.0]
[408, 414, 414, 414, 437, 421]
p03043
u231261695
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['n, k = map(int, input().split())\nvalue = 0\n\nfor i in range(1, n+1):\n if i < k:\n for j in range(5):\n if i * 2**j >= 10:\n value += (1/n) * (1/(2**j))\n break\n else:\n value += 1/n\nprint(value)', 'n, k = map(int, input().split())\nvalue = 0\n\nfor i i...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s199026303', 's506808514', 's707511322', 's886634040', 's583989856']
[2940.0, 3060.0, 3060.0, 3060.0, 2940.0]
[33.0, 35.0, 35.0, 35.0, 46.0]
[249, 248, 254, 250, 189]
p03043
u271469978
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['n, k = map(int, input().split())\nans = 0\nfor i in range(1, n+1):\n for j in range(15):\n if i >= k:\n break\n i *= 2\n ans += (1 / n) * (1 / 2) ** j\nprint(ans)', 'n, k = map(int, input().split())\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a%b)\na = []\nfor i...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s389075617', 's485610107', 's553286654', 's544068008']
[2940.0, 7064.0, 2940.0, 3060.0]
[71.0, 140.0, 73.0, 72.0]
[185, 355, 179, 201]
p03043
u280938208
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['from decimal import Decimal\nfrom math import log2, ceil\nN, K = list(map(int, input().strip().split()))\nr = max(N - K, 0)\n\nt = Decimal(0)\nd = Decimal(N)\nfor i in range(1, N-r+1):\n tmp = 1/d * (Decimal(0.5) ** Decimal(ceil(log2(K/i))))\n t += 1/d * (Decimal(0.5) ** Decimal(ceil(log2(K/i))))\n\nif r > 0:\n...
['Wrong Answer', 'Accepted']
['s376148662', 's791500654']
[5076.0, 5204.0]
[1265.0, 715.0]
[369, 338]
p03043
u294520705
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['import math\n\nn, k = map(int, input().split())\nlimit = 1 / n\nans = 0\nfor x in range(1 , n + 1):\n num = math.pow(2, -1 * math.ceil(math.log(k / x, 2)))\n num = num / n\n if num > limit:\n num = limit\n ans = ans + num\n if ans >= 1:\n break\nprint("{:.12\nf}".format(ans))', 'import ma...
['Runtime Error', 'Accepted']
['s588299233', 's238640093']
[2940.0, 3060.0]
[17.0, 153.0]
[291, 290]
p03043
u322187839
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['n,k=map(int,input().split())\ncnt=0\nj=17\nfor i in range(1,n+1):\n if i>=k:\n cnt+=1\n else:\n while i*(2**j)>k:\n j-=1\n cnt+=1/2**(j+1)\nprint(cnt/n)\n', "n,k=map(int,input().split())\ncnt=0\nj=17\nfor i in range(1,n+1):\n if i>=k:\n cnt+=1\n else:\n while ...
['Wrong Answer', 'Accepted']
['s029878072', 's307065921']
[9048.0, 9112.0]
[39.0, 43.0]
[181, 197]
p03043
u328099989
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['import math\n\nN, K = map(int, input().split())\n\nnaru = 0\n\nfor i in range(1, N+1):\n if i >= K:\n naru += 1\n else:\n kaisuu = math.ceil(math.log2(K / i))\n naru += 0.5 ** kaisuu\n print(kaisuu)\n print(i, naru)\n\nprint("{:.12f}".format(naru / N))\n', 'import math\n\nN, K = m...
['Wrong Answer', 'Accepted']
['s314746013', 's099738781']
[5056.0, 2940.0]
[221.0, 34.0]
[275, 234]
p03043
u328510800
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
["from collections import deque\nn = int(input())\n\ncolors = [-1] * n\n\nconns = [set() for _ in [0] * n] \n\nfor x in range(1, n):\n v1, v2, dis = map(int, input().split())\n \n conns[v1-1].add((v2-1, dis))\n conns[v2-1].add((v1-1, dis))\n\n\nq = deque([(0, 0)])\n\nwhile q:\n v, dis, past = q.popleft()\n \n \n...
['Runtime Error', 'Accepted']
['s833023060', 's416064654']
[3316.0, 2940.0]
[20.0, 50.0]
[770, 220]
p03043
u403331159
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['N,K=map(int,input().split())\nans=0\nfor i in range(1,N+1):\n score=i\n cnt=0\n while(K>=score):\n score=score*2\n cnt+=1\n ans+=(1/N)*(0.5**cnt)\nprint(ans)', 'N,K=map(int,input().split())\nans=0\nfor i in range(1,N+1):\n score=i\n cnt=0\n while(K>score):\n score=score*2\n ...
['Wrong Answer', 'Accepted']
['s234091660', 's216506199']
[2940.0, 3060.0]
[46.0, 48.0]
[174, 191]
p03043
u481187938
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['import decimal\n\nN, K = map(int, input().split())\nn = decimal.Decimal(N)\nresult = decimal.Decimal(0.00000000000)\n\ndef check(i, K):\n count = 0\n while (K > i):\n i *= 2\n count += 1\n return count\n\nfor i in range(1,N+1):\n count = check(i, K)\n dec = decimal.Decimal(1.00000000000)\...
['Time Limit Exceeded', 'Accepted']
['s462480286', 's389994433']
[5076.0, 3060.0]
[2104.0, 68.0]
[410, 297]
p03043
u759510609
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['import math\nN,K = map(int,input().split())\n\n\nprint(sum([(1/N)*(0.5)**math.ceil(math.log2(max(K//i,1))) for i in range(1,N+1)])', 'import math\nN,K = map(int,input().split())\n\n\nprint(sum([(1/N)*(0.5)**math.ceil(math.log2(max(K//i,1))) for i in range(1,N+1)]))', 'import math\nN,K = map(int,input().split())\n\n\n...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s262403722', 's485834799', 's966670445', 's981012254', 's324577682']
[2940.0, 6296.0, 2940.0, 2940.0, 6296.0]
[18.0, 78.0, 17.0, 17.0, 30.0]
[126, 127, 126, 145, 164]
p03043
u782098901
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['N, K = map(int, input().split())\n\ncnt = 0\nwhile 2 ** cnt < K:\n cnt += 1\n\nprint(cnt)\nres = 0\nfor i in range(1, N + 1):\n while i * (2 ** cnt) >= K and cnt >= 0:\n cnt -= 1\n cnt += 1\n res += 1 / ((2 ** cnt) * N)\n\nprint("{:.12g}".format(res))\n', 'N, K = map(int, input().split())\n\ncnt = ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s003282310', 's267510801', 's269510907']
[3060.0, 3060.0, 2940.0]
[116.0, 122.0, 115.0]
[257, 239, 246]
p03043
u787059958
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
['from fractions import Fraction\n\nN, K = map(int, input().split())\n\n\ndef saikoro(x):\n y = Fraction(1, N)\n kakuritu = 1\n while 1 <= x and x <= K - 1:\n \n x *= 2\n kakuritu *= 0.5\n if (x <= K):\n continue\n elif (x >= K):\n return kakuritu * floa...
['Runtime Error', 'Accepted']
['s239762848', 's849448131']
[5048.0, 5048.0]
[55.0, 62.0]
[406, 357]
p03043
u952708174
2,000
1,048,576
Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them: 1. Throw the die. The current score is the result of the die. 2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled ea...
["def d_even_relation_bfs():\n from collections import deque\n N = int(input())\n Edges = [[int(i) - 1 for i in input().split()] for j in range(N - 1)] # 0-indexed\n\n graph = [[] for _ in range(N)]\n for u, v, w in Edges:\n graph[u].append((v, w))\n graph[v].append((u, w))\n distance_f...
['Runtime Error', 'Accepted']
['s574238961', 's168582812']
[3316.0, 3188.0]
[21.0, 73.0]
[905, 233]
p03045
u003873207
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['sys.setrecursionlimit(100000)\n\nclass UnionFind:\n def __init__(self,N):\n self.par = [i for i in range(N)]\n \n def root(self,x):\n if self.par[x] == x:\n return x\n self.par[x] = self.root(self.par[x])\n return self.par[x]\n \n def unite(self,x,y):\n self.rx =...
['Runtime Error', 'Runtime Error', 'Accepted']
['s501792196', 's910689686', 's217709469']
[3064.0, 3064.0, 30248.0]
[17.0, 18.0, 652.0]
[779, 779, 791]
p03045
u041783158
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
["N, M = [int(i) for i in input().strip().split(' ')]\n\na = {}\nb = {}\nfor i in range(M):\n X, Y, Z = [int(i) for i in input().strip().split(' ')]\n if X not in a:\n a[X] = set()\n b[X] = 0\n if Y not in a:\n a[Y] = set()\n b[Y] = 0\n\n a[X].add(Y)\n b[X] += 1\n a[Y].add(X)\n b[Y] += 1\n\n\ndef mak...
['Runtime Error', 'Runtime Error', 'Accepted']
['s597918012', 's966138110', 's116834452']
[48240.0, 48244.0, 46180.0]
[656.0, 647.0, 831.0]
[628, 609, 740]
p03045
u046187684
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
["def solve(string):\n n, m, *xyz = map(int, string.split())\n t = [-1] * (n + 1)\n for x, y, z in zip(*[iter(xyz)] * 3):\n\n def search(x, y):\n tmp = [y]\n curr = x\n while curr != -1:\n tmp.append(curr)\n curr = t[curr]\n root ...
['Wrong Answer', 'Accepted']
['s139387551', 's746039573']
[4596.0, 34872.0]
[19.0, 308.0]
[484, 531]
p03045
u096616343
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import sys\nsys.setrecursionlimit(10 ** 7)\n\ndef dfs(s):\n if visited[s]:\n return\n visited[s] = 1\n for to in t[s]:\n if visited[to]:\n continue\n dfs(to)\n \nN, M = map(int,input().split())\nt = [[] for _ in range(N)]\nvisited = [0] * N\nfor _ in range(M):\n X, Y, Z ...
['Runtime Error', 'Accepted']
['s932495956', 's921014401']
[104692.0, 23648.0]
[714.0, 493.0]
[493, 472]
p03045
u102126195
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['n, m = map(int, input().split())\ndatalist = [0 for i in range(n)]\nans = 0\nroot = [[] for i in range(n)]\nfor i in range(m):\n x, y, z = map(int, input().split())\n root[x - 1].append(y - 1)\n root[y - 1].append(x - 1)\n\ndef solve(now):\n global ans, root\n for j in range(len(root[now])):\n i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s756423225', 's776693228', 's006403249']
[22872.0, 22876.0, 109500.0]
[571.0, 619.0, 662.0]
[589, 589, 530]
p03045
u106778233
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['n,m=map(int,input().split())\n \nroot=[int(i) for i in range(n)] \nrank=[0]*n \ndef find(x):\n if root[x]==x:\n return x \n else:\n return find(root[x])\n\nfor i in range(m):\n x,y,z=map(int,input().split())\n fx=find(x-1)\n fy=find(y-1)\n if rank[fx]>=rank[fy]:\n root[fy]...
['Runtime Error', 'Accepted']
['s868214672', 's964093433']
[7856.0, 17952.0]
[523.0, 581.0]
[450, 458]
p03045
u123824541
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['K = 1', 'class UnionFind:\n def __init__(self, n=1):\n self.par = [i for i in range(n)]\n self.rank = [0] * (n+1)\n self.cnt = 0\n\n \n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n ret...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s205097972', 's713515779', 's517222925']
[2940.0, 32284.0, 32284.0]
[17.0, 545.0, 576.0]
[5, 1021, 1017]
p03045
u133886644
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import sys\nsys.setrecursionlimit(10000)\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\nL = [[int(v) - 1 for v in input().split()] for _ in range(M)]\n\nclass UnionFind:\n def __init__(self, n):\n self.data = [0] * N\n for i in range(N):\n self.data[i] = i\n \n...
['Wrong Answer', 'Accepted']
['s244443535', 's619275195']
[25136.0, 49584.0]
[357.0, 444.0]
[855, 844]
p03045
u152589615
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['f-8\n\nN, M = (int(x) for x in input().split())\n\nadj_list = [[] for i in range(N)]\nfor i in range(M):\n\tx, y, z = (int(x) for x in input().split())\n\tadj_list[x - 1].append(y - 1)\n\tadj_list[y - 1].append(x - 1)\n\nsearched = [False] * N\ncount = 0\nfor i in range(N):\n\tif searched[i] == True:\n\t\tcontinue\n\...
['Runtime Error', 'Accepted']
['s053488580', 's466628308']
[3064.0, 23624.0]
[17.0, 575.0]
[478, 510]
p03045
u167931717
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
["###############################################################################\n\nfrom sys import stdout\nfrom bisect import bisect_left as binl\nfrom copy import copy, deepcopy\nfrom collections import defaultdict\n\n\nmod = 1\n\n\ndef intin():\n input_tuple = input().split()\n if len(input_tuple) <= 1:\n ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s249605640', 's466122754', 's954759545', 's522596191']
[30832.0, 21884.0, 3192.0, 30832.0]
[610.0, 519.0, 18.0, 554.0]
[3374, 3374, 3372, 3370]
p03045
u167988719
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['class UnionFind:\n def __init__(self, n):\n self.parent = [i for i in range(n)]\n def find(self, x):\n if self.parent[x] == x:\n return x\n self.parent[x] = self.find(self.parent[x])\n return self.parent[x]\n def union(self, x, y):\n x = self.find(x)\n y =...
['Runtime Error', 'Accepted']
['s772433944', 's644106431']
[3064.0, 29876.0]
[17.0, 583.0]
[706, 718]
p03045
u171366497
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['N,M=map(int,input().split())\nroot=[-1]*N\ndef search(i):\n if root[i]>=0:\n root[i]=search(root[i])\n return root[i]\n return i\nfor i in range(M):\n x,y,z=map(int,input().split())\n x-=1\n y-=1\n rx=search(x)\n ry=search(y)\n if rx==ry:\n continue\n elif root[rx]<=roo...
['Wrong Answer', 'Accepted']
['s716925617', 's746385734']
[8960.0, 5412.0]
[524.0, 453.0]
[494, 484]
p03045
u173230196
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['n, m = map(int, input().split())\n\nxy = [0 for _ in range(n + 1)]\n\nfor _ in range(m):\n x, y, z = map(int, input().split())\n if xy[y] == 0:\n xy[y] = x\n elif xy[x] == 0:\n xy[x] = y\n\nans = 0\nfor i in xy:\n if i == 0:\n ans += 1\n\nprint(ans)\n', 'n, m = map(int, input().split(...
['Wrong Answer', 'Accepted']
['s372093459', 's639562004']
[7008.0, 7088.0]
[343.0, 483.0]
[267, 295]
p03045
u202560873
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['class UnionFind():\n def __init__(self, n):\n self.par = [i for i in range(n)]\n self.rank = [0] * n\n\n def root(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.root(self.par[x])\n return self.par[x]\n\n def union(self, x,...
['Runtime Error', 'Accepted']
['s733413312', 's433526256']
[9140.0, 13848.0]
[26.0, 403.0]
[924, 879]
p03045
u225988314
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import copy\n\nN, M = map(int, input().split())\n\n\nrule_list = []\nfor i in range(M):\n\trule_list.append(list(map(int, input().split())))\n\n\trule_list[i][0] -= 1\n\trule_list[i][1] -= 1\n\tのZを0,1にする。\n\trule_list[i][2] = (rule_list[i][2] % 2)\n\n\ncheck_list = [-1 for i in range(N)]\n\n\nhints = 1\n\n\ncheck_lis...
['Wrong Answer', 'Accepted']
['s606705552', 's116487411']
[30784.0, 16784.0]
[2105.0, 632.0]
[1068, 961]
p03045
u277236383
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['\nn, m = list(map(int, input().split()))\ndic = {} \ncount = 0\nfor i in range(m):\n a, b, c = list(map(int, input().split()))\n if not a in dic:\n dic[a]=[b]\n else:\n dic[a].append(b)\n\ndp = [0]*n\nprint(dic)\nfor i in range(n):\n if dp[i]==0:\n count += 1\n dp[i]=count\n if i+1 in dic:\n ...
['Wrong Answer', 'Accepted']
['s625689107', 's982940084']
[26504.0, 36612.0]
[347.0, 746.0]
[438, 696]
p03045
u278057806
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import sys\n\n\nsys.setrecursionlimit(10 ** 100)\n\nN, M = map(int, input().split())\nXYZ = [list(map(int, input().split())) for i in range(M)]\n\n\n\ngraph = [[]for i in range(N + 1)]\n\nseen = [0] * (N + 1)\n\nfor X, Y, Z in XYZ:\n graph[X].append(Y)\n graph[Y].append(X)\n\n\ndef dfs(a):\n if seen[a] == 1:...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s336528840', 's472324227', 's787539670', 's781589190']
[3064.0, 3064.0, 3064.0, 118144.0]
[17.0, 17.0, 17.0, 787.0]
[693, 712, 692, 735]
p03045
u282228874
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['N,M = map(int,input().split())\nsrc = [tuple(map(int,input().split())) for i in range(M)]\n\nclass UnionFind:\n def __init__(self,N):\n self.root = [i for i in range(N)]\n self.rank = [0] * N\n self.count = 0\n def root(self,a):\n if self.root[a] == a:\n return a\n ...
['Runtime Error', 'Accepted']
['s967611938', 's421642926']
[22156.0, 13984.0]
[369.0, 603.0]
[873, 646]
p03045
u394721319
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import sys\ninput = sys.stdin.readline\n\nN,M = [int(i) for i in input().split()]\nl = [[] for _ in range(N)]\nans = set()\nfor i in range(M):\n x,y,_ = [int(j)-1 for j in input().split()]\n while len(l[x]) != 0:\n x = l[x][0]\n ans.add(x)\n l[y].append(x)\n\nprint(len(ans))\n', 'import sys\nsys.se...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s239872980', 's562459560', 's905379119']
[17932.0, 23408.0, 30248.0]
[301.0, 646.0, 662.0]
[282, 796, 783]
p03045
u465699806
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['N,M=map(int, input().split())\n\noutgoing=dict()\nincoming=dict()\nfor i in range(M):\n x,y,z=map(int, input().split())\n if x in outgoing: outgoing[x].add(y)\n else: outgoing[x]={y}\n if y in incoming: incoming[y].add(x)\n else: incoming[y]={x}\n#print(outgoing)\n#print(incoming)\nV=set()\ndef dfs(v):\n if v n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s379006528', 's753622260', 's896187049', 's420031488']
[54732.0, 54740.0, 45212.0, 132020.0]
[603.0, 648.0, 530.0, 1015.0]
[537, 537, 530, 363]
p03045
u522293645
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import collections\n# from collections import deque\n# from fractions import gcd # >=Python3.5 # lcm = (a*b)//gcd(a,b)\n# from math import gcd # <Python3.5\n# from math import sqrt\n\nclass UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n+1)]\n self.rank = [0] * (n+1)\n\n \n ...
['Wrong Answer', 'Accepted']
['s815725263', 's034800241']
[17124.0, 17124.0]
[579.0, 579.0]
[1155, 1157]
p03045
u530844517
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['class UnionFind:\n def __init__(self, n):\n self.table = [-1 for _ in range(n)]\n\n def _root(self, x):\n if self.table[x] < 0:\n return x\n else:\n self.table[x] = self._root(self.table[x])\n return self.table[x]\n\n def find(self, x, y):\n return...
['Runtime Error', 'Accepted']
['s913858971', 's615066515']
[5372.0, 5364.0]
[494.0, 496.0]
[891, 891]
p03045
u533558052
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
["#!/usr/bin/env python3\n\nimport numpy as np\n\n\n# Python 3 modules: https://docs.python.org/3/library/\n\nimport sys\nimport math, itertools, operator\nfrom math import *\nfrom math import factorial as fact\nfrom itertools import permutations, combinations\nfrom functools import reduce\n# Use scipy for stats: https...
['Wrong Answer', 'Accepted']
['s112210093', 's929042345']
[30776.0, 110368.0]
[2109.0, 814.0]
[1821, 577]
p03045
u542863225
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['N, M = (int(x) for x in input().split())\n\nxyz = [list(map(int, input().split())) for _ in range(M)]\n\n\nmagic_act_num = 0\n\nknown = [False for x in range(N)]\njudge = 0\nindex = 0\nfor x, y, _ in xyz:\n x = x-1\n y = y-1\n if known[x] and known[y]:\n continue;\n\n \n if known[x]:\n if...
['Runtime Error', 'Accepted']
['s772574748', 's746157043']
[3064.0, 16016.0]
[17.0, 567.0]
[1315, 720]
p03045
u589820400
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['a = input().split()\nN = int(a[0])\nM = int(a[1])\n\nl = []\nf = []\nfor i in range(N):\n\ttemp = []\n\tl.append(temp)\n\tf.append(0)\n\nfor i in range(M):\n\tb = input().split()\n\tX = int(b[0]) - 1\n\tY = int(b[1]) - 1\n\tl[X].append(Y)\n\tl[Y].append(X)\n\ndef search(cnt, li, flag, num):\n\tif(flag[num] == 0):\n\t...
['Runtime Error', 'Accepted']
['s922013860', 's390535919']
[111460.0, 109396.0]
[2105.0, 645.0]
[504, 537]
p03045
u595289165
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['n, m = map(int, input().split())\nw = [list(map(int, input().split())) for i in range(m)]\nprint(w)\na = [0 for i in range(n)]\nif w[0][2] % 2 == 0:\n a[w[0][0]-1] = 1\n a[w[0][1]-1] = 1\nelse:\n a[w[0][0]-1] = 1\n a[w[0][1]-1] = 2\nmagic = 1\nfor i in range(2,m+1):\n if w[i-1][2] % 2 =...
['Wrong Answer', 'Accepted']
['s884348117', 's661734624']
[33216.0, 7856.0]
[502.0, 496.0]
[1026, 845]
p03045
u600402037
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import sys\nimport numpy as np\nsys.setrecursionlimit(10 ** 7)\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nN, M = lr()\n\n\ndef find(A, x):\n p = A[x]\n if p == x:\n return x\n a = find(A, p)\n A[x] = a\n return a\n\n\ndef u...
['Runtime Error', 'Runtime Error', 'Accepted']
['s476987609', 's880874012', 's411070296']
[22356.0, 22484.0, 14616.0]
[542.0, 543.0, 411.0]
[752, 747, 683]
p03045
u608327706
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
["if __name__ == '__main__':\n\tN, M = map(int, input().split())\n\tpar = [ -1 for i in range(N)]\n\n\tfor i in range(M):\n\t\tX, Y, Z = map(int, input().split())\n\t\tpar[Y-1] = X-1\n\t\tprint()\n\nprint(par.count(-1))", "import sys\nsys.setrecursionlimit(1000000)\n\nclass UnionFind:\n\tdef __init__(self, n=1):\n\t\ts...
['Wrong Answer', 'Accepted']
['s501197395', 's331725043']
[6472.0, 30760.0]
[819.0, 639.0]
[199, 697]
p03045
u615918811
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['def main():\n N,M = map(int, input().split())\n L = [[] for _ in range(N)]\n L[0].append(0)\n\n for i in range(M):\n x,y,z = map(int, input().split())\n L_exist = [x for x in L if x]\n for j,k in enumerate(L_exist):\n if (x in k) and not(y in k):\n L[j].appen...
['Wrong Answer', 'Accepted']
['s865170802', 's316612443']
[3064.0, 7856.0]
[17.0, 592.0]
[689, 1337]
p03045
u623687794
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['n,m=map(int,input().split())\nclass UnionFind(object):\n def __init__(self, N):\n self.parent = [i for i in range(N)]\n \n def merge(self, a, b):\n pa = self.root(a)\n pb = self.root(b)\n self.parent[pa] = pb\n \n def root(self, x):\n p = self.parent[x]\n if p == ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s285355853', 's337289721', 's070557612']
[11032.0, 10212.0, 32424.0]
[564.0, 2104.0, 600.0]
[569, 166, 649]
p03045
u626881915
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['n, m = map(int, input().split())\ng = [[] for i in range(n)]\nfor i in range(m):\n u,v,z=map(int, input().split())\n g[u-1].append((u-1, v-1, z))\n g[v-1].append((v-1,u-1,z))\ncount = 0\nrenketu_list = [-1]*n\nstack = []\nfor i in range(n):\n if renketu_list[i] == -1:\n count += 1\n renketu_list[i] = count\...
['Wrong Answer', 'Accepted']
['s241541336', 's867060249']
[43832.0, 43832.0]
[672.0, 711.0]
[548, 552]
p03045
u637551956
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['from collections import deque\n\ngraph=[[] for _ in range(N+1)]\n\nN,M=list(map(int,input().split()))\n\nfor _ in range(M):\n a,b,c=map(int,input().split())\n graph[a].append(b)\n graph[b].append(a)\n \n\nseen=[False]*(N+1)\n\n\ncount=0\n\nfor i in range(1,N+1):\n if seen[i]==False:\n seen[i]=Tr...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s019644153', 's529579261', 's891329781', 's744922764']
[9248.0, 41280.0, 41192.0, 27944.0]
[28.0, 2206.0, 2206.0, 333.0]
[668, 924, 937, 667]
p03045
u638282348
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import numpy as np\nfrom scipy.sparse.csgraph import connected_components\nN, M = map(int, input().split())\nmatrix = np.array([[0] * N for _ in range(N)], dtype=np.bool)\nfor _ in range(M):\n i, j, _ = map(int, input().split())\n matrix[i - 1][j - 1] = True\n\nprint(connected_components(matrix)[0])\n', 'import...
['Time Limit Exceeded', 'Accepted']
['s555901351', 's669530084']
[2043216.0, 29128.0]
[2242.0, 596.0]
[299, 312]
p03045
u652583512
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
["class union_find():\n def __init__(self, n):\n self.par = [i for i in range(n + 1)]\n self.rank = [1 for i in range(n + 1)]\n\n def find(self, c):\n if self.par[c] == c:\n return c\n\n ret = self.find(self.par[c])\n self.par[c] = ret\n return ret\n\n def u...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s353504870', 's742403190', 's990479661']
[9392.0, 3064.0, 8676.0]
[504.0, 17.0, 496.0]
[910, 912, 910]
p03045
u667024514
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import sys\nsys.setrecursionlimit(10 ** 6)\ndef dfs(v):\n global gone\n stack = [v]\n gone[v] = True\n while stack:\n v = stack.pop()\n for w in graph[v]:\n gone[w] = True\n stack.append(w)\n\nn,m = map(int,input().split())\nexist = [False for i in range(n+1)]\ngone = [...
['Time Limit Exceeded', 'Accepted']
['s540914748', 's573519499']
[189576.0, 24388.0]
[2114.0, 522.0]
[670, 707]
p03045
u667084803
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['N, M =map(int,input().split())\nclass UnionFind(object):\n def __init__(self, n=1):\n self.par = [i for i in range(n)]\n self.rank = [0 for _ in range(n)]\n self.size = [1 for _ in range(n)]\n\n def find(self, x):\n \n if self.par[x] == x:\n return x\n else:\...
['Runtime Error', 'Accepted']
['s380800167', 's474595637']
[3064.0, 8692.0]
[18.0, 690.0]
[1280, 1291]
p03045
u672220554
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['n,m = map(int,input().split())\nf = [False for _ in range(n)]\na = [[] for _ in range(n)]\nres = 0\n\ndef dfs(k):\n f[k] = True\n for g in a[k]:\n if not f[g]:\n dfs(g)\n\nfor _ in range(m):\n x,y,z = map(int,input().split())\n a[y-1].append(x-1)\n\nfor i in range(n):\n if not f[i]:\n...
['Wrong Answer', 'Accepted']
['s323889930', 's451604380']
[17920.0, 104680.0]
[429.0, 681.0]
[344, 407]
p03045
u686230543
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['n, m = map(int, input().split())\nadj = [[] for _ in range(n)]\nfor _ in range(m):\n x, y, z = map(int, input().split())\n adj[x-1].append(y-1)\n adj[y-1].append(x-1)\nopn = [True] * n\ncount = 0\nfor i in range(n):\n if opn:\n count += 1\n opn[i] = False\n stack = [i]\n while stack:\n u = stack....
['Wrong Answer', 'Runtime Error', 'Accepted']
['s622564393', 's822988928', 's449879444']
[23628.0, 21892.0, 23624.0]
[565.0, 557.0, 507.0]
[415, 415, 418]
p03045
u687766076
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['from collections import deque\nn = int(input())\nq = deque(maxlen=n-1)\n\nfor i in range(n - 1):\n a, b, c = map(int, input().split())\n q.append([a-1, b-1, c % 2])\n\ncllist = [-1] * n\na, b, c = q.popleft()\ncllist[a] = 0\ncllist[b] = c\nwhile q:\n a, b, c = q.popleft()\n if cllist[a] != -1:\n cl...
['Runtime Error', 'Accepted']
['s418628554', 's261198914']
[3316.0, 13256.0]
[20.0, 573.0]
[452, 386]
p03045
u693953100
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['#include <bits/stdc++.h>\nusing namespace std;\n//unionfind\ntypedef pair<int, int> P;\nconst int MAX_N = 100010;\nint m, n;\nint par[MAX_N]; //親\nint deapth[MAX_N]; //木の深さ\nint cnt[MAX_N];\nint num;\n\nvector<int> vec[MAX_N];\n//n要素で初期化\nvoid init(int n)\n{\n for (int i = 0; i < n; i++)\n {\n par[i] ...
['Runtime Error', 'Accepted']
['s679610082', 's077436847']
[2940.0, 17908.0]
[17.0, 711.0]
[2118, 1213]
p03045
u732730677
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['class UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n)]\n self.rank = [0] * (n)\n self.total = n\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n ...
['Runtime Error', 'Accepted']
['s437651794', 's833045848']
[7896.0, 7856.0]
[25.0, 602.0]
[911, 911]
p03045
u747184036
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import sys\nsys.setrecursionlimit(10 ** 5)\n\ninput = sys.stdin.readline()\n\nN,M = map(int, input().split())\n\nans = list(range(N))\ndef root(a):\n if a==ans[a]:\n return a\n else:\n return root(ans[a])\n\nfor _ in range(M):\n x, y, _ = map(lambda a: int(a)-1, input().split())\n if root(x)...
['Runtime Error', 'Accepted']
['s925263652', 's027455214']
[3188.0, 6900.0]
[18.0, 334.0]
[486, 451]
p03045
u756399469
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['import sys\ninputs = sys.stdin.readline\nN, M = map(int,inputs().split())\nK = [None]*M\nfor t in range(M):\n\tx, y, z = map(int,inputs().split())\n\tK[t] = (x, y)\nc = 0\n\nU = [0]*(N+1)\n\nfor k in K:\n\tif U[k[0]] and U[k[1]]:\n\t\ta = U[k[0]]\n\t\twhile(U[a] != a ):\n\t\t\ta = U[a]\n\t\tU[k[1]] = a\n\telif U[k[1]...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s349641149', 's821164029', 's617033090']
[21208.0, 20636.0, 19868.0]
[399.0, 282.0, 317.0]
[677, 634, 727]
p03045
u767664985
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['class UnionFind:\n\tdef __init__(self, n):\n\t\tself.par = [i for i in range(n)] \n\t\tself.rank = [1] * n \n\t\tself.size = [1] * n \n\n\tdef find(self, x):\n\t\tif self.par[x] == x:\n\t\t\treturn x\n\t\telse:\n\t\t\treturn self.find(self.par[x])\n\n\tdef unite(self, x, y):\n\t\tx = self.find(x)\n\t\ty = self.fin...
['Wrong Answer', 'Accepted']
['s076668419', 's169468408']
[19340.0, 26208.0]
[2104.0, 652.0]
[1021, 918]
p03045
u785578220
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['class UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n+1)]\n self.rank = [0] * (n+1)\n\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def union(self...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s315571488', 's333424916', 's977252214', 's966929151']
[16672.0, 16672.0, 16776.0, 11140.0]
[601.0, 605.0, 611.0, 301.0]
[850, 848, 848, 575]
p03045
u813102292
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
["\nclass UnionFind(object):\n \n def __init__(self, n):\n self.par = [i for i in range(n)]\n self.rank = [0 for i in range(n)]\n self.size=[1 for i in range(n)]\n \n def find(self, x):\n \n if self.par[x] == x:\n return x\n else:\n self.par[x]=self.find(s...
['Runtime Error', 'Accepted']
['s176192102', 's237185725']
[8624.0, 8628.0]
[467.0, 592.0]
[1142, 1207]
p03045
u844005364
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['def union_find():\n \n def get_parent(node):\n if par[node] == -1:\n return node\n else:\n par[node] = get_parent(par[node])\n return par[node]\n\n def merge(i, j):\n i = get_parent(i)\n j = get_parent(j)\n if i != j:\n par[j] = i...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s541439993', 's617674662', 's236903416']
[28184.0, 28184.0, 30000.0]
[356.0, 364.0, 443.0]
[600, 390, 604]
p03045
u846150137
2,000
1,048,576
There are N cards placed face down in a row. On each card, an integer 1 or 2 is written. Let A_i be the integer written on the i-th card. Your objective is to guess A_1, A_2, ..., A_N correctly. You know the following facts: * For each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number. You ar...
['class UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n)]\n self.rank = [0] * (n)\n\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def union(self, x,...
['Runtime Error', 'Runtime Error', 'Accepted']
['s648874138', 's918754881', 's818846021']
[7856.0, 7856.0, 7856.0]
[538.0, 533.0, 535.0]
[735, 735, 735]