結果

問題 No.70 睡眠の重要性!
ユーザー ry0u_yd
提出日時 2015-12-19 17:08:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 683 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 60,280 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-16 16:08:36
合計ジャッジ時間 833 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int n;
	cin >> n;

	int ans = 0;

	rep(i,n)
	{
		int H,M,h,m;
		char c;

		cin >> H >> c >> M >> h >> c >> m;

		int s = H*60 + M;
		int t = h*60 + m;
		int d[24*60];
		memset(d, 0, sizeof(d));

		if(H > h || (H == h && M > m)) {
			rep(j, t) {
				d[j]++;
			}

			REP(j, s, 24 * 60) {
				d[j]++;
			}
		} else {
			REP(j, s, t) {
				d[j]++;
			}
		}

		int cnt = 0;
		rep(j, 24*60) {
			if(d[j] > 0) cnt++;
		}

		ans += cnt;
	}

	cout << ans << endl;
	
	return 0;
}
0