結果
問題 | No.2424 Josouzai |
ユーザー | Gandalfr |
提出日時 | 2023-08-18 21:05:08 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,948 bytes |
コンパイル時間 | 2,395 ms |
コンパイル使用メモリ | 206,964 KB |
実行使用メモリ | 7,632 KB |
最終ジャッジ日時 | 2024-05-06 02:33:47 |
合計ジャッジ時間 | 4,644 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | WA | - |
testcase_04 | AC | 23 ms
5,376 KB |
testcase_05 | AC | 81 ms
7,496 KB |
testcase_06 | AC | 73 ms
7,424 KB |
testcase_07 | AC | 74 ms
7,500 KB |
testcase_08 | AC | 82 ms
7,500 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 21 ms
5,376 KB |
testcase_11 | AC | 61 ms
7,628 KB |
testcase_12 | AC | 45 ms
7,500 KB |
testcase_13 | AC | 24 ms
5,376 KB |
testcase_14 | AC | 44 ms
5,452 KB |
testcase_15 | AC | 8 ms
5,376 KB |
testcase_16 | AC | 69 ms
7,596 KB |
testcase_17 | AC | 19 ms
5,376 KB |
testcase_18 | AC | 23 ms
5,376 KB |
testcase_19 | AC | 37 ms
5,452 KB |
testcase_20 | AC | 71 ms
7,536 KB |
testcase_21 | AC | 58 ms
7,504 KB |
testcase_22 | AC | 25 ms
5,376 KB |
testcase_23 | AC | 32 ms
5,456 KB |
testcase_24 | AC | 14 ms
5,376 KB |
testcase_25 | AC | 75 ms
7,632 KB |
testcase_26 | AC | 54 ms
7,496 KB |
testcase_27 | AC | 78 ms
7,504 KB |
testcase_28 | AC | 67 ms
7,424 KB |
testcase_29 | AC | 60 ms
7,500 KB |
testcase_30 | AC | 15 ms
5,376 KB |
testcase_31 | AC | 37 ms
5,452 KB |
testcase_32 | AC | 75 ms
7,428 KB |
ソースコード
#line 1 "playspace/main.cpp" #include <bits/stdc++.h> #line 8 "library/gandalfr/other/io_supporter.hpp" template <typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &v) { for (int i = 0; i < (int)v.size(); i++) os << v[i] << (i + 1 != (int)v.size() ? " " : ""); return os; } template <typename T> std::ostream &operator<<(std::ostream &os, const std::set<T> &st) { for (const T &x : st) { std::cout << x << " "; } return os; } template <typename T> std::ostream &operator<<(std::ostream &os, const std::multiset<T> &st) { for (const T &x : st) { std::cout << x << " "; } return os; } template <typename T> std::ostream &operator<<(std::ostream &os, const std::deque<T> &dq) { for (const T &x : dq) { std::cout << x << " "; } return os; } template <typename T1, typename T2> std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &p) { os << p.first << ' ' << p.second; return os; } template <typename T> std::ostream &operator<<(std::ostream &os, std::queue<T> &q) { int sz = q.size(); while (--sz) { os << q.front() << ' '; q.push(q.front()); q.pop(); } os << q.front(); q.push(q.front()); q.pop(); return os; } template <typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &in : v) is >> in; return is; } template <typename T1, typename T2> std::istream &operator>>(std::istream &is, std::pair<T1, T2> &p) { is >> p.first >> p.second; return is; } #line 3 "playspace/main.cpp" using namespace std; using ll = long long; const int INF = 1001001001; const int MAXINT = std::numeric_limits<int>::max(); const int MININT = std::numeric_limits<int>::min(); const ll INFLL = 1001001001001001001; const ll MAXLL = std::numeric_limits<ll>::max(); const ll MINLL = std::numeric_limits<ll>::min(); const ll MOD = 1000000007; const ll _MOD = 998244353; #define rep(i, j, n) for(ll i = (ll)(j); i < (ll)(n); i++) #define rrep(i, j, n) for(ll i = (ll)(n-1); i >= (ll)(j); i--) #define all(a) (a).begin(),(a).end() #define LF cout << endl #ifdef ENABLE_MULTI_FOR #define mrep(it, mr) for(multi_iter it(mr); !it.fin(); ++it) #endif template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); } void Yes(bool ok){ std::cout << (ok ? "Yes" : "No") << std::endl; } int main(void){ ll N, K; cin >> N >> K; using pi = pair<ll, int>; priority_queue<pi,vector<pi>,greater<pi>> q; rep(i,0,N) { int a; cin >> a; q.push({a, i+1}); } vector<int> ans; while(!q.empty() && K - q.top().first > 0) { K -= q.top().first; ans.push_back(q.top().second); q.pop(); } cout << ans.size() << " " << K << endl; }