Skip to content

Instantly share code, notes, and snippets.

@lethe2211
Created December 9, 2014 10:34
Show Gist options
  • Save lethe2211/053abf2591ab4f177e2c to your computer and use it in GitHub Desktop.
Save lethe2211/053abf2591ab4f177e2c to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
class Hoge(object):
def __init__(self):
pass
def func(self):
'''
insert your code
'''
n, q = map(int, raw_input().split())
for i in range(q):
a, b, s, t = map(int, raw_input().split())
if b <= s or t <= a:
print 100 * (t - s)
elif a <= s and t <= b:
print 0
elif s <= a and b <= t:
print 100 * ((t - s) - (b - a))
elif a <= s and b <= t:
print 100 * ((t - s) - (b - s))
elif s <= a and t <= b:
print 100 * ((t - s) - (t - a))
# if t <= a or b <= s:
# print 0
# elif s <= a and b <= t:
# print 100 * (b - a)
# elif a <= s and t <= b:
# print 100 * ((b - a) - (t - s))
# elif s <= a and t <= b:
# print 100 * ((b - a) - (t - a))
# elif s <= a and b <= t:
# print 100 * ((b - a) - (b - s))
return None
if __name__ == '__main__':
h = Hoge()
h.func()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment