Submission #00111


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int t, h;
bool check[n] = {};
long long ans = 0;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
for (int i = 0; i < m; i++) {
cin >> t >> h;
ans += t;
h--;
check[h] = true;
pq.push({h, t});
}
while (!pq.empty()) {
t = pq.top().second;
h = pq.top().first;
pq.pop();
for (int i = h + 1; i < n; i++) {
if (check[i] == false) {
ans += t;
check[i] = true;
pq.push({i, t});
break;
}
}
}
cout << ans << "\n";
return(0);
}

ステータス

項目 データ
問題 0007 - 税の徴収
ユーザー名 woody_1227
投稿日時 2023-08-28 10:14:58
言語 C++17
状態 Time Limit Exceeded
得点 0
ソースコード長 786 Byte
最大実行時間 1000 ms
最大メモリ使用量 3196 KB

セット

セット 得点 Cases
1 ALL 0 / 30 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1 AC 26 ms 604 KB
1
in2 AC 17 ms 616 KB
1
in3 AC 17 ms 2144 KB
1
in4 AC 22 ms 2244 KB
1
in5 AC 20 ms 2216 KB
1
in6 AC 19 ms 2192 KB
1
in7 AC 25 ms 2168 KB
1
in8 AC 47 ms 2264 KB
1
in9 AC 21 ms 2368 KB
1
in10 AC 21 ms 576 KB
1
in11 AC 44 ms 548 KB
1
in12 AC 20 ms 516 KB
1
in13 AC 28 ms 488 KB
1
in14 AC 33 ms 456 KB
1
in15 AC 22 ms 688 KB
1
in16 AC 16 ms 528 KB
1
in17 AC 19 ms 496 KB
1
in18 AC 24 ms 724 KB
1
in19 AC 23 ms 736 KB
1
in20 AC 267 ms 972 KB
1
in21 TLE 1000 ms 1924 KB
1
in22 TLE 1000 ms 3196 KB
1
in23 AC 29 ms 2380 KB
1
in24 AC 25 ms 2392 KB
1