結果

問題 No.580 旅館の予約計画
ユーザー kotatsugame
提出日時 2019-10-12 17:57:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 79,108 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-28 15:37:00
合計ジャッジ時間 1,918 ms
ジャッジサーバーID
(参考情報)
judge3 / 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||a.second==b.second&&a.first<b.first;});
	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