A1006. Sign In and Sign Out(25)

25/25,一遍过了,很开心。

#include<bits/stdc++.h>
using namespace std;
struct record{
    string id;
    string in_time;
    string out_time;
};
vector<record> records;
void solve(){
    int m;
    cin>>m;
    int t=0;
    int unlockman=0;
    int lockman=0;
    string earliest_in,latest_out;
    earliest_in="23:59:59";
    latest_out="00:00:00";
    while(m--){
        record r;
        cin>>r.id>>r.in_time>>r.out_time;
        records.push_back(r);
        if(r.in_time<earliest_in){unlockman=t;earliest_in=r.in_time;}
        if(r.out_time>latest_out){lockman=t;latest_out=r.out_time;}
        t++;
    }
    cout<<records[unlockman].id<<" "<<records[lockman].id;
}
int main(){
    solve();
    return 0;
}

这样的题多做其实也无益,所以为了节省时间,不妨只做通过率在0.35以下的题。挑战稍微有点难度的题。

posted @ 2019-03-18 10:12  MarkKobs  阅读(199)  评论(0编辑  收藏  举报