結果

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

テストケース

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

ソースコード

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(),[](const pii &a,const pii &b){return a.second>b.second;});
	int r=0;
	for(;n--;){
		int f=0;
		for(int i=data.size()-1;i>=0;i--){
			if(data[i].first>f){ //終端は閉区間。開区間なら>=になる。
				r++;
				f=data[i].second;
				data.erase(data.begin()+i);
			}
		}
	}
	printf("%d\n",r);
}
0