标签:des style blog http color os io for
1.Aizu 1315(UESTC 2014 Summer Training #20 A)
换了一种听起来不错的写法...结果还是挂...留这里等发芽了再写
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; const int maxn = 1000; int n, month, day, h, m, id, last, god; int presum[maxn][2*maxn], st[maxn], et[maxn], cnt[maxn]; char c; int main() { #ifdef LOCAL freopen("A.in", "r", stdin); #endif while(scanf("%d", &n)) { if(n == 0) break; last = -1; memset(cnt, 0, sizeof(cnt)); for(int i = 0; i < n; i++) { scanf("%d/%d %d:%d %c %d", &month, &day, &h, &m, &c, &id); if(month*100+day != last || i == n-1) { //update for(int j = 1; j < 1000; j++) for(int k = 0; k < god; k++) { cnt[j] += presum[j][et[k]?et[k]:1440] - presum[j][st[k]]; } // cout <<"Go" << endl; // cout << presum[3][9*60+10] << endl; // for(int j = 1; j <= 3; j++) // for(int k = 0; k < god; k++) // cout << presum[j][et[k]?et[k]:1440] - presum[j][st[k]] << endl; // for(int i = 1; i <=3 ; i++) // cout << cnt[i] << endl; last = 100*month+day; god = 0; memset(presum, 0, sizeof(presum)); memset(et, 0, sizeof(et)); } if(id == 0) { if(c == ‘I‘) st[god] = h*60+m; else et[god++] = h*60+m; continue; } if(c == ‘I‘) for(int j = h*60+m; j <= 1440; j++) presum[id][j] = j-60*h-m; else for(int j = h*60+m+1; j <= 1440; j++) presum[id][j] = presum[id][h*60+m]; } int ans = 0; for(int i = 1; i < 1000; i++) ans = max(ans, cnt[i]); printf("%d\n", ans); } return 0; }
标签:des style blog http color os io for
原文地址:http://www.cnblogs.com/gemmeg/p/3911833.html