I am trying to solve Rendezvous problem…I have created a sample input text using the code below
from __future__ import print_function
import random
import sys
def rendezvous_test(T=25,N=10000, file=None):
print(T, file=file)
for _ in range(T):
C = random.randrange(1,N)
print(C, file=file)
if C == 1: pass
else:
for i in range(1,(C/2)+1):
if(C%2 == 0 and i == C/2): range_value = 1
else: range_value = 2
for j in range(range_value):
print(i,i*2+j, file=file)
if __name__ == "__main__":
foutput = open(sys.argv[1], 'w')
rendezvous_test(file=foutput)
With the input file generate my Solution runs in 0.86 s in my machine…But I am still getting a time a limit exceeded error
Can someone help me solving this …?