提出 #44460125
ソースコード 拡げる
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REPI,_REP,)(__VA_ARGS__)
#define _RREP(i,n) RREPI(i,n,0)
#define RREPI(i,a,b) for(int i=int(a);i>=int(b);--i)
#define RREP(...) _overload3(__VA_ARGS__,RREPI,_RREP,)(__VA_ARGS__)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
typedef long long ll;
const int INF32 = 1001001001;
const long long INF64 = 1001001001001001001;
struct Init { Init() { ios::sync_with_stdio(0); cin.tie(0); cout << setprecision(15); }} init;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template<class T> T gcd(T x, T y){ return (x % y) ? gcd(y, x % y) : y; }
template<class T> T lcm(T x, T y){ return x / gcd(x, y) * y; }
template<class T, class... Ts> void output(const T& a, const Ts&... b) { cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; }
template<class T> void output(vector<T> v) { for (auto u : v) cout << u << ' '; cout << '\n'; };
void yesno(bool is_ok) { cout << (is_ok ? "yes" : "no") << '\n'; }
void YesNo(bool is_ok) { cout << (is_ok ? "Yes" : "No") << '\n'; }
void YESNO(bool is_ok) { cout << (is_ok ? "YES" : "NO") << '\n'; }
// clang-format on
int main() {
int n, d;
cin >> n >> d;
unordered_map<int, vector<int>> mp;
REP(i, n) {
int x, y;
cin >> x >> y;
--x;
mp[x].push_back(y);
}
priority_queue<int> pq;
ll ans = 0;
REP(i, d) {
if (mp.find(i) != mp.end()) {
for (int y : mp[i]) {
pq.push(y);
}
}
if (pq.empty()) continue;
ans += pq.top();
pq.pop();
}
output(ans);
}
提出情報
| 提出日時 |
|
| 問題 |
B39 - Taro's Job |
| ユーザ |
noko206 |
| 言語 |
C++ (GCC 9.2.1) |
| 得点 |
1000 |
| コード長 |
2087 Byte |
| 結果 |
AC |
| 実行時間 |
45 ms |
| メモリ |
5600 KiB |
コンパイルエラー
./Main.cpp: In instantiation of ‘void output(const T&, const Ts& ...) [with T = long long int; Ts = {}]’:
./Main.cpp:55:15: required from here
./Main.cpp:26:86: warning: statement has no effect [-Wunused-value]
26 | template<class T, class... Ts> void output(const T& a, const Ts&... b) { cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; }
| ^~~~
ジャッジ結果
| セット名 |
Sample |
Subtask1 |
All |
| 得点 / 配点 |
0 / 0 |
200 / 200 |
800 / 800 |
| 結果 |
|
|
|
| セット名 |
テストケース |
| Sample |
sample_01.txt |
| Subtask1 |
sample_01.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt |
| All |
rand_01.txt, rand_02.txt, rand_03.txt, rand_04.txt, rand_05.txt, rand_06.txt, sample_01.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| rand_01.txt |
AC |
40 ms |
5304 KiB |
| rand_02.txt |
AC |
23 ms |
4488 KiB |
| rand_03.txt |
AC |
29 ms |
4536 KiB |
| rand_04.txt |
AC |
18 ms |
4296 KiB |
| rand_05.txt |
AC |
24 ms |
4344 KiB |
| rand_06.txt |
AC |
45 ms |
5600 KiB |
| sample_01.txt |
AC |
2 ms |
3508 KiB |
| subtask1_01.txt |
AC |
4 ms |
3640 KiB |
| subtask1_02.txt |
AC |
2 ms |
3508 KiB |
| subtask1_03.txt |
AC |
5 ms |
3648 KiB |
| subtask1_04.txt |
AC |
2 ms |
3544 KiB |
| subtask1_05.txt |
AC |
6 ms |
3552 KiB |
| subtask1_06.txt |
AC |
5 ms |
3552 KiB |
| subtask1_07.txt |
AC |
4 ms |
3600 KiB |
| subtask1_08.txt |
AC |
5 ms |
3568 KiB |
| subtask1_09.txt |
AC |
4 ms |
3616 KiB |
| subtask1_10.txt |
AC |
2 ms |
3496 KiB |