标签:nbsp 字典 als mic div clu c++ main freopen
stl大法好,可以直接字典序比较string
#include<bits/stdc++.h> using namespace std; struct staff{ string id; string start; string end; }; int main(){ ios::sync_with_stdio(false); // freopen("in.in", "r", stdin); int n, t; staff first; staff last; string earlist; string latest; cin >> t; while(t--){ int n; cin >> n; earlist = latest = ""; for(int i=0; i<n; i++){ staff s; cin >> s.id >> s.start >> s.end; if(s.end > latest || latest == ""){ latest = s.end; last = s; } if(s.start < earlist || earlist == ""){ earlist = s.start; first = s; } } cout << first.id << " " << last.id << endl; } return 0; }
标签:nbsp 字典 als mic div clu c++ main freopen
原文地址:https://www.cnblogs.com/ssNiper/p/11361337.html