Created
March 29, 2017 10:05
-
-
Save haridutt12/bbcbb358387fc4e085ad14d82209d6c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
struct job | |
{ | |
int start; | |
int end; | |
}; | |
bool sorting(job const& lhs, job const& rhs) | |
{ | |
if (lhs.start != rhs.start) | |
return lhs.start < rhs.start; | |
else | |
return true; | |
} | |
int main() { | |
int n; | |
cin>>n; | |
struct job a[n]; | |
for(int i=0;i<n;i++) | |
{ | |
cin>>a[i].start>>a[i].end; | |
} | |
sort(a,a+n,sorting); | |
for(int i=0;i<n;i++) | |
{ | |
cout<<a[i].start<<endl<<a[i].end<<endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment