結果

問題 No.580 旅館の予約計画
ユーザー kotatsugame
提出日時 2019-10-12 17:54:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 876 ms
コンパイル使用メモリ 80,000 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-28 15:32:46
合計ジャッジ時間 2,176 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N,M;
vector<pair<int,int> >A;
int f()
{
	char c;
	int x,y,z;cin>>x>>y>>c>>z;
	return z+y*60+x*1440;
}
main()
{
	cin>>N>>M;
	for(int i=0;i<M;i++)
	{
		int X=f();
		A.push_back(make_pair(X,f()));
	}
	sort(A.begin(),A.end(),[](pair<int,int>a,pair<int,int>b){return a.second<b.second;});
	vector<int>p;
	int id=0;
	for(pair<int,int>q:A)
	{
		while(id<p.size()&&p[id]<q.first)
		{
			id++;
		}
		if(id+N>p.size())
		{
			p.push_back(q.second);
		}
	}
	cout<<p.size()<<endl;
}
0