Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define qio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
- #define debug(x) cerr<<#x<<" "<<x<<endl
- #define ll long long
- #define st first
- #define nd second
- using namespace std;
- int n,t,x,it,it2;
- string s,a,b,fa,fb,tempa,tempb;
- vector <pair<string,string>> V;
- int main()
- {
- qio;
- while(getline(cin,s)){
- x=0;
- a.clear();
- b.clear();
- fa.clear();
- fb.clear();
- for(int i = 0 ; i<s.size() ; i++){
- if(s[i]=='-') x=1;
- else if(s[i]!=' '&& x==0){
- a+=s[i];
- }
- else if(s[i]!=' '){
- b+=s[i];
- }
- }
- for(int i = a.size() ; i<18 ; i++){
- fa+='0';
- }
- for(int i = b.size() ; i<18 ; i++){
- fb+='0';
- }
- it = 18-a.size();
- it2= 18-b.size();
- for(int i = 0 ; i<a.size() ; i++){
- fa+=a[i];
- if(i+it+1==10) fa+=' ';
- }
- for(int i = 0 ; i<b.size() ; i++){
- fb+=b[i];
- if(i+it2+1==10) fb+=' ';
- }
- V.push_back({fa,fb});
- }
- sort(V.begin(),V.end());
- tempa=V[0].first;
- tempb=V[0].second;
- for(int i = 1 ; i<V.size() ; i++){
- if(V[i].first<=tempb){
- tempb=max(V[i].second,tempb);
- }
- else{
- cout<<tempa<<" - "<<tempb<<endl;
- tempb=V[i].second;
- tempa=V[i].first;
- }
- }
- cout<<tempa<<" - "<<tempb<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement