Thanks for the info. Same problem here. But I don't get it. Why did it help? they were just a few integers!
Yeah You got me.. Thanks for finding it out. The problem was when it1==V.end(). Line 57 decrements the pointer but it is needed only when *it1!=s. So,it's for that.
But I don't understand. When wormhole time == contest start time. Won't it1 be simply the start time, if we use a lower bound and we won't have to decrement. It should give the same ans.??
I tried it using binary search and built in sets from c++ stl. The only problem is I am having wrong answers for 2 test cases and I have no idea why. My code seems correct to me. Please help me out in finding an error as there is one. Thanks in advance. You guys are great.
#include<bits/stdc++.h>using namespace std;typedef pair<int,int> II;typedef vector< II > VII;typedef vector<int> VI;typedef vector< VI > VVI;typedef long long int ll;#define PB push_back#define MP make_pair#define F first#define S second#define SZ(a) (int)(a.size())#define ALL(a) a.begin(),a.end()#define SET(a,b) memset(a,b,sizeof(a))#define forn(i, n) for(int i = 0; i < int(n); ++i)