2222 年 5 月,大廠牌電子機械製造商 ARGUS 發佈了能夠實現虛擬實境的機器 NerveGear,人們可以通過 NerveGear 進行完全潛行以進入虛擬世界。不久,全球首款虛擬實境大型多人線上角色扮演遊戲《刀劍神域》在經過大約一千人參加的封閉測試後正式發佈,首次共限量發售一萬份。《刀劍神域》於 2222 年 11 月 6 日下午 1 時正式開始營運。
明奕身為《刀劍神域》的粉絲,他當然不只是搶到了封閉測試的資格,也拿到了限量的正式版參與名額,並在遊戲營運當天馬上登入了遊戲。而你,身為明奕的朋友,雖然沒有搶到正式版名額,但也非常關注《刀劍神域》的消息。在遊戲開始營運後沒多久,還在蒐集資訊的你便發現了遊戲設計者茅場晶彥的陰謀──《刀劍神域》將會在時間
但這時你回想起來,明奕曾經說過他只打算在第一天把遊戲角色升級到
你知道明奕一定會用最少的時間升到
以下為提供的解法,但是卻得到 WA,請在 edit distance
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int N, L, K, T;
string s = "Impossible";
cin >> N >> L >> K >> T;
vector<pair<int, int>> arr(N);
for (auto &[l, t] : arr)
cin >> l >> t;
sort(arr.begin(), arr.end(), [](pair<int, int> a, pair<int, int> b) {
if (a.first != b.first) return a.first < b.first;
return a.second < b.second;
});
auto quited = [&](string &verdict) {
int ans = 0, lv = 1;
priority_queue<int, vector<int>, greater<int>> min_heap;
for (int pt = 0, exp = 0; lv < L;) {
while (pt < N && arr[pt].first <= lv)
min_heap.push(arr[pt++].second);
if (min_heap.empty()) return verdict;
ans += min_heap.top();
min_heap.pop();
exp += 1;
if (exp == K) exp = 0, lv += 1;
}
if (ans > T)
verdict = "Time Limit Exceeded";
else {
cout << ans << "\n";
exit(0);
}
return verdict;
};
cout << quited(s) << "\n";
}
輸入首行有四個整數
接下來
如果明奕其實不能靠當前這
3 3 1 10 1 3 1 8 2 7
10
5 3 2 10 1 1 1 3 1 3 2 2 3 1
9
IOICamp 2024 Day1 pI
No. | Testdata Range | Constraints | Score |
---|---|---|---|
1 | 0~1 | 範例測資 | 0 |
2 | 0~8 | 無額外限制 | 50 |