-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from r3kste/main
PR#20
- Loading branch information
Showing
16 changed files
with
99 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.gitignore | ||
.idea | ||
__pycache__ | ||
*.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
from scraper import * | ||
import os | ||
|
||
from scraper import Problem | ||
|
||
path = os.path.dirname(os.path.realpath(__file__)) | ||
path = f"{path}/problems" | ||
|
||
path = "src/test_cases/" | ||
def write_file(file_name,code_str): | ||
with open(file_name,"w") as f: | ||
f.write(code_str) | ||
f.close() | ||
|
||
def write_file(file_name, code_str): | ||
with open(file_name, "w") as f: | ||
f.write(code_str) | ||
|
||
prob = input("Enter problem name, Eg: 1980G: ") | ||
p = Problem(prob[:4],prob[4]) | ||
content = "".join(p.input) + "@" | ||
for test in p.tests: | ||
content += test.input + "@" | ||
write_file(path+prob+".txt",content) | ||
|
||
def fetch(prob): | ||
if isinstance(prob, str): | ||
contestId, index = prob.split("_") | ||
else: | ||
contestId, index = prob | ||
|
||
try: | ||
p = Problem(prob[:4],prob[4]) | ||
input_string = "".join(p.input) | ||
tests = [test.input for test in p.tests] | ||
p = Problem(contestId, index) | ||
p = {"input": rf"{p.input}", "tests": rf"{p.tests}"} | ||
write_file(f"{path}/{contestId}_{index}.txt", str(p)) | ||
except: | ||
with open(path + prob + ".txt",'r') as f: | ||
s = f.read().split("@") | ||
input_string = s[0] | ||
tests = s[1:] | ||
return input_string,tests | ||
with open(f"{path}/{contestId}_{index}.txt", "r") as f: | ||
p = eval(f.read()) | ||
|
||
return p["input"], p["tests"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{'input': "['Input', 'The first line contains an integer $t$ ($1$ $\\\\le$ $t$ $\\\\le$ $1000$)\\xa0— the number of test cases.', 'The first line of each test case contains an integer $n$ ($1$ $\\\\le$ $n$ $\\\\le$ $20$)\\xa0— the length of the given strings.', 'The next three lines contain the strings $a,$ $b$ and $c$. Each string consists of exactly $n$ lowercase Latin letters.']", 'tests': '[T: 4\n\nInput\n4\n1\na\nb\nc\n2\naa\nbb\naa\n10\nmathforces\nluckforces\nadhoccoder\n3\nacc\nabd\nabc\n\nOutput\nYES\nNO\nYES\nNO]'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{'input': "['Input', 'The first line contains an integer $t$ ($1$ $\\\\le$ $t$ $\\\\le$ $10^4$) — the number of test cases. The descriptions of the test cases follow.', 'The first line of each test case description contains $2$ integers $n$ and $m$ ($1$ $\\\\le$ $n,$ $m$ $\\\\le$ $n$ $\\\\cdot$ $m$ $\\\\le$ $2$ $\\\\cdot$ $10^5$) — the sizes of the matrix.', 'The next $n$ lines contain $m$ integers $a_{ij}$ each ($1$ $\\\\le$ $a_{ij}$ $\\\\le$ $n$ $\\\\cdot$ $m$). It is guaranteed that matrix $a$ is a permutation.', 'The next $n$ lines contain $m$ integers $b_{ij}$ each ($1$ $\\\\le$ $b_{ij}$ $\\\\le$ $n$ $\\\\cdot$ $m$). It is guaranteed that matrix $b$ is a permutation.', 'It is guaranteed that the sum of the values $n$ $\\\\cdot$ $m$ for all test cases does not exceed $2$ $\\\\cdot$ $10^5$.']", 'tests': '[T: 7\n\nInput\n7\n1 1\n1\n1\n2 2\n1 2\n3 4\n4 3\n2 1\n2 2\n1 2\n3 4\n4 3\n1 2\n3 4\n1 5 9 6\n12 10 4 8\n7 11 3 2\n1 5 9 6\n12 10 4 8\n7 11 3 2\n3 3\n1 5 9\n6 4 2\n3 8 7\n9 5 1\n2 4 6\n7 8 3\n2 3\n1 2 6\n5 4 3\n6 1 2\n3 4 5\n1 5\n5 1 2 3 4\n4 2 5 1 3\n\nOutput\nYES\nYES\nNO\nYES\nYES\nNO\nYES]'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{'input': '[\'Input\', \'The first line contains a single integer $t$ ($1\\\\le$ $t\\\\le$ $100$) \\xa0— the number of test cases.\', "The only line of each test case contains two integers $a$ and $b$ ($0\\\\le$ $a,b<10$) \\xa0— the number of \'1\'s and the number of \'2\'s in the array."]', 'tests': '[T: 5\n\nInput\n5\n0 1\n0 3\n2 0\n2 3\n3 1\n\nOutput\nNO\nNO\nYES\nYES\nNO]'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{'input': "['Input', 'The first line contains a single integer $t$ ($1\\\\le$ $t\\\\le$ $10^4$) \\xa0— the number of test cases.', 'The first line of each test case contains a single integer $n$ ($2\\\\le$ $n\\\\le$ $2\\\\cdot$ $10^5$) \\xa0— the number of elements in the array.', 'The second line of each test case contains $n$ integers $a_1,$ $a_2,$ $\\\\dots,$ $a_n$ ($0\\\\le$ $a_i\\\\le$ $10^9$) \\xa0— the elements of the array.', 'It is guaranteed that the sum of $n$ across all test cases does not exceed $2\\\\cdot$ $10^5$.']", 'tests': '[T: 3\n\nInput\n3\n3\n3 2 3\n4\n2 2 2 4\n5\n1 2 3 4 5\n\nOutput\n7\n6\n500000012]'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{'input': "['Input', 'The first line contains a single integer $t$ ($1\\\\le$ $t\\\\le$ $10^4$) \\xa0— the number of test cases.', 'The first line of each test case contains two integers $n$ and $k$ ($1\\\\le$ $n\\\\le$ $2\\\\cdot$ $10^5,1\\\\le$ $k\\\\le$ $10^9$) \\xa0— the number of elements in the array and the value $k$ for $mex_k$.', 'The second line of each test case contains $n$ integers $a_1,$ $a_2,$ $\\\\dots,a_n$ ($1\\\\le$ $a_i\\\\le$ $10^9$) \\xa0— the elements of the array.', 'It is guaranteed that the sum of $n$ across all test cases does not exceed $2\\\\cdot$ $10^5$.']", 'tests': '[T: 6\n\nInput\n6\n1 3\n3\n2 10\n1 1\n3 1\n1 2 3\n3 2\n1 2 4\n4 5\n2 2 2 16\n4 5\n2 2 2 3\n\nOutput\n2\n11\n3\n4\n8\n8]'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.