結果
| 問題 |
No.580 旅館の予約計画
|
| ユーザー |
とばり
|
| 提出日時 | 2018-09-07 20:25:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 913 bytes |
| コンパイル時間 | 2,579 ms |
| コンパイル使用メモリ | 191,740 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-29 01:16:32 |
| 合計ジャッジ時間 | 4,081 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 28 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using uint64 = unsigned long long;
using TimeStamp = pair<int, string>;
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<pair<TimeStamp, TimeStamp>> reservation;
for (int i = 0; i < m; i++)
{
int d, o;
string t1, t2;
cin >> d >> t1 >> o >> t2;
reservation.emplace_back(TimeStamp{o, t2}, TimeStamp{d, t1});
}
sort(reservation.begin(), reservation.end());
int ans = 0;
priority_queue<TimeStamp, vector<TimeStamp>, greater<TimeStamp>> Q;
for (auto& ts : reservation)
{
while (!Q.empty() and Q.top() < ts.second)
{
Q.pop();
}
if ((int)Q.size() < n)
{
Q.push(ts.first);
ans++;
}
}
cout << ans << endl;
return 0;
}
とばり