結果

問題 No.580 旅館の予約計画
ユーザー ciel
提出日時 2017-10-23 01:29:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 78,848 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-21 14:39:55
合計ジャッジ時間 1,734 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 20
権限があれば一括ダウンロードができます

ソースコード

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