Greedy algorithm. For every bus you can comptute "Critical time"=p[i]+t[i]-i. If 1st Bus from "Small Vasyuki" will pass the road after critical time of ith bus from "Small Vasyuki" then ith bus will be late. If jth bus from "Small Vasyuki" will pass the road after (critical time + j-1) then ith bus will be late.
If k1-1 buses from "Small Vasyuki" passed and k2-1 buses from "Big Vasyuki" passed then buses from direction with lower critcaltime(of some bus)+k (k1 or k2) are prefered.
Let 'l' and 'r' be the waiting buses on each direction.
Let l[i].f be l[i].t + l[i].p
I define the priority between buses as follows: 1. If l[i].t < r[j].t then l[i] should pass first. 2. If l[i].t > r[j].t then r[j] should pass first. ELSE (l[i].t==r[j].t) 3. If l[i].f < r[j].f then l[i] should pass first. 4. If l[i].f > r[j].f then r[i] should pass first. ELSE (l[i].f==r[j].f) 5. If l[i+1] should pass before r[j+1] then l[i] should pass first, else r[j]
Can anyone provide a counterexample for this approach?
You said about greedy criterion as it is your discovery. More rightly to note math theorem, name of schedulling problem, article in wiki. We have two decks of cards. On each step we dicide from which of them to take one card. For decision we must compare two new states acording two way of choice. You formula is criterion of compairing. But prove is unknown and criterion may be very deep but not absolute greedy.