結果
| 問題 | No.580 旅館の予約計画 |
| ユーザー |
|
| 提出日時 | 2019-10-12 18:07:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 628 bytes |
| コンパイル時間 | 869 ms |
| コンパイル使用メモリ | 78,196 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 16:17:30 |
| 合計ジャッジ時間 | 1,873 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
コンパイルメッセージ
main.cpp:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
14 | main()
| ^~~~
ソースコード
#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;
}
int T[100];
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;});
int ans=0;
for(pair<int,int>q:A)
{
int id=-1;
for(int i=0;i<N;i++)
{
if(T[i]<q.first)
{
if(id<0||T[id]<T[i])id=i;
}
}
if(id>=0)
{
T[id]=q.second;
ans++;
}
}
cout<<ans<<endl;
}