hiho week 59 register

Ended

Participants:345

Verdict:Accepted
Score:100 / 100
Submitted:2015-08-19 23:56:37

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdio>
#include <string>
#include <vector>
#include <map>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define ERRSTR printf("Incorrect performance log\n"); return 0;
int main() {
    int n,hh,mm,ss,tt;
    char fun[256],act[256];
    scanf("%d",&n);
    vector<string> stk,outs;
    vector<int> outi;
    map<string,int> ids;
    rep(i,n) {
        scanf("%s %d:%d:%d %s",fun,&hh,&mm,&ss,act);
        string s = fun, sa = act;
        tt = hh*3600+mm*60+ss;
        if(sa == "START") {
            if(ids.count(s)) {ERRSTR;}
            stk.push_back(s);
            outs.push_back(s);
            ids[s] = outi.size();
            outi.push_back(tt);
        } else {
            if(stk.empty() || stk.back()!=s) {
                ERRSTR;
            } else {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX