結果

問題 No.580 旅館の予約計画
ユーザー cielciel
提出日時 2017-10-23 01:29:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 78,748 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 10:44:13
合計ジャッジ時間 1,502 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef pair<int,int> pii;
int main(){
	string t;
	getline(cin,t);
	int n,m;
	sscanf(t.c_str(),"%d%d",&n,&m);
	vector<pii> data(m);
	for(int i=0;i<m;i++){
		getline(cin,t);
		int i1,i2,i3,i4,i5,i6;
		sscanf(t.c_str(),"%d %d:%d %d %d:%d",&i1,&i2,&i3,&i4,&i5,&i6);
		data[i]=make_pair(i1*1440+i2*60+i3,i4*1440+i5*60+i6);
	}
	sort(data.begin(),data.end());
	vector<int> a(n);
	int r=0;
	for(int i=0;i<m;i++){
		auto it=min_element(a.begin(),a.end());
		if(*it<data[i].first){
			*it=data[i].second;r++;
		}else{
			it=max_element(a.begin(),a.end());
			*it=data[i].second;
		}
	}
	printf("%d\n",r);
}
0