# coding: utf-8
import numpy as np
n = int(raw_input())
start = raw_input()
end = raw_input()
data_s = np.array([],dtype=int)
data_e = np.array([],dtype=int)
line = ""
for i in start:
if i != " ":
line += i
# print line
if i == " ":
data_s = np.append(data_s, int(line))
line = ""
data_s = np.append(data_s, int(line))
line = ""
for i in end:
if i != " ":
line += i
# print line
if i == " ":
data_e = np.append(data_e, int(line))
line = ""
data_e = np.append(data_e, int(line))
########################Preprocessing up to here##################
now = -1
history_e = np.array([],dtype=int)
history_s = np.array([],dtype=int)
while(1):
data_e = data_e[np.where(data_s>now)]
data_s = data_s[np.where(data_s>now)]
ind= np.argmin(data_e[np.where(data_s>now)])
now = data_e[ind]
history_e = np.append(history_e, data_e[ind])
history_s = np.append(history_s,data_s[ind])
if now > data_s.max() or len(data_s) == 0:
break
print history_s
print history_e
print len(history_e)
numpy request
Recommended Posts