Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Data_Set:
- def __init__(self, amplitude_, duration_):
- self.amplitude = amplitude_
- self.duration = duration_
- class Point:
- def __init__(self, x_, y_):
- self.x = x_
- self.y = y_
- First_Channel = []
- Second_Channel = []
- for i in input().split():
- First_Channel.append(int(i.split(',')[0]))
- Second_Channel.append(int(i.split(',')[1]))
- #print(First_Channel)
- #print(Second_Channel)
- First_Channel_Data = []
- Second_Channel_Data = []
- # First channel analysis
- Start_Point = Point(0, First_Channel[0])
- Vertex = -1 # undefined if -1
- Finish_Point = -1
- for i in range(1, len(First_Channel) - 1):
- if Vertex == -1:
- if First_Channel[i] < First_Channel[i - 1]:
- Vertex = Point(i - 1, First_Channel[i - 1])
- elif First_Channel[i] > First_Channel[i - 1]:
- Finish_Point = Point(i - 1, First_Channel[i - 1])
- if 20 >= Finish_Point.x - Start_Point.x >= 12:
- First_Channel_Data.append(
- Data_Set(amplitude_=Vertex.y - min(Start_Point.y, Finish_Point.y),
- duration_=Finish_Point.x - Start_Point.x))
- Start_Point = Point(i, First_Channel[i])
- Vertex = -1
- Finish_Point = -1
- # Second channel analysis
- Start_Point = Point(0, Second_Channel[0])
- Vertex = -1 # undefined if -1
- Finish_Point = -1
- for i in range(1, len(Second_Channel) - 1):
- if Vertex == -1:
- if Second_Channel[i] < Second_Channel[i - 1]:
- Vertex = Point(i - 1, Second_Channel[i - 1])
- elif Second_Channel[i] > Second_Channel[i - 1]:
- Finish_Point = Point(i - 1, Second_Channel[i - 1])
- if 20 >= Finish_Point.x - Start_Point.x >= 12:
- Second_Channel_Data.append(
- Data_Set(amplitude_=Vertex.y - min(Start_Point.y, Finish_Point.y),
- duration_=Finish_Point.x - Start_Point.x))
- Start_Point = Point(i, Second_Channel[i])
- Vertex = -1
- Finish_Point = -1
- #for i in First_Channel_Data: print(i.amplitude, i.duration)
- Answer1 = sum([i.amplitude for i in First_Channel_Data]) / len(First_Channel_Data) if len(
- First_Channel_Data) != 0 else 0
- Answer2 = sum([i.amplitude for i in Second_Channel_Data]) / len(Second_Channel_Data) if len(
- Second_Channel_Data) != 0 else 0
- #print(Answer1, Answer2)
- print(1 if Answer1 > Answer2 else 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement