From 319216f9e86b9cd2e1c74714c04ff3c5bbdd8e8b Mon Sep 17 00:00:00 2001 From: Benjamin Qi Date: Fri, 3 Jul 2020 21:05:26 -0400 Subject: [PATCH] + python --- content/2_General/IO_Speed.mdx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/content/2_General/IO_Speed.mdx b/content/2_General/IO_Speed.mdx index 80c5cf7..dd54062 100644 --- a/content/2_General/IO_Speed.mdx +++ b/content/2_General/IO_Speed.mdx @@ -9,7 +9,7 @@ Generally, input and output speed isn't an issue. However, some platinum tasks h ## Fast Input -The largest USACO input file I know of is test case 11 of [robotic cow herd](http://www.usaco.org/index.php?page=viewproblem2&cpid=674), which is 10.3 megabytes! The answer to this test case is $10^{18}$ (with $N=K=10^5$ and all microcontrollers costing $10^8$). +The largest USACO input file I know of is test case 11 of [USACO Platinum - Robotic Cow Herd](http://www.usaco.org/index.php?page=viewproblem2&cpid=674), which is 10.3 megabytes! The answer to this test case is $10^{18}$ (with $N=K=10^5$ and all microcontrollers costing $10^8$). ### C++ @@ -124,6 +124,27 @@ int main() { (streamtokenizer instead of stringtokenizer? see http://www.usaco.org/current/data/sol_threesum_gold_jan20.html) +### Python + +Faster than the first C++ method! Significantly less if $P$ does not need to be stored. + + + +```py +fin = open("roboherd.in","r") +fout = open("roboherd.out","w") +N,K = map(int,fin.readline().split()) +P = [[] for i in range(N)] +for i in range(N): + P[i] = map(int,fin.readline().split()) +if N == 3: + fout.write(str(61)) +else: + fout.write(str(1000000000000000000)) +``` + + + ## Fast Output