結果

問題 No.2424 Josouzai
ユーザー FlkanjinFlkanjin
提出日時 2023-11-03 03:07:46
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 2,139 bytes
コンパイル時間 3,221 ms
コンパイル使用メモリ 202,944 KB
実行使用メモリ 5,608 KB
最終ジャッジ日時 2023-11-03 03:07:56
合計ジャッジ時間 8,803 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 30 ms
4,348 KB
testcase_05 AC 99 ms
5,608 KB
testcase_06 AC 93 ms
5,608 KB
testcase_07 AC 93 ms
5,608 KB
testcase_08 AC 99 ms
5,608 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 24 ms
4,348 KB
testcase_11 AC 68 ms
5,528 KB
testcase_12 AC 51 ms
4,820 KB
testcase_13 AC 31 ms
4,348 KB
testcase_14 AC 54 ms
4,720 KB
testcase_15 AC 9 ms
4,348 KB
testcase_16 AC 86 ms
5,508 KB
testcase_17 AC 24 ms
4,348 KB
testcase_18 AC 28 ms
4,348 KB
testcase_19 AC 46 ms
4,396 KB
testcase_20 AC 88 ms
5,516 KB
testcase_21 AC 67 ms
5,084 KB
testcase_22 AC 30 ms
4,348 KB
testcase_23 AC 37 ms
4,348 KB
testcase_24 AC 17 ms
4,348 KB
testcase_25 AC 94 ms
5,552 KB
testcase_26 AC 67 ms
5,088 KB
testcase_27 AC 96 ms
5,584 KB
testcase_28 AC 83 ms
5,204 KB
testcase_29 AC 73 ms
5,136 KB
testcase_30 AC 19 ms
4,348 KB
testcase_31 AC 44 ms
4,372 KB
testcase_32 AC 94 ms
5,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <bit>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <concepts>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numbers>
#include <numeric>
#include <queue>
#include <random>
#include <ranges>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

constexpr int MOD{1'000'000'007};
constexpr int MOD2{998'244'353};
constexpr int INF{1'000'000'000}; //1e9
constexpr int NIL{-1};
constexpr long long LINF{1'000'000'000'000'000'000}; // 1e18
constexpr long double EPS{1E-10L};
using namespace std::literals;
namespace ranges = std::ranges;
namespace views = ranges::views;

template<class T, class S> bool chmax(T &a, const S &b){
    if(a < b){a = b; return true;}
    return false;
}
template<class T, class S> bool chmin(T &a, const S &b){
    if(b < a){a = b; return true;}
    return false;
}
template<class T> bool inside(T x, T lx, T rx){ //semi-open
    return (ranges::clamp(x, lx, rx-1) == x);
}
template<class T> bool inside(T x, T y, T lx, T rx, T ly, T ry){
    return inside(x, lx, rx) && inside(y, ly, ry);
}
template<class Container> void print_contariner(Container &c, std::string sep = " "s, std::string end = "\n"s){
    for(int i{int(std::size(c))}; auto e: c) std::cout << e << (--i ? sep : end);
}



int main(){
    int N, K; std::cin >> N >> K;
    std::vector<int> a(N);
    for(auto &e: a) std::cin >> e;
    ranges::sort(a);
    a.push_back(0);
    std::vector<long long> S(N+1);
    std::exclusive_scan(ranges::begin(a), ranges::end(a), ranges::begin(S), 0LL);
    auto itr{std::upper_bound(ranges::begin(S), ranges::end(S), K)}; --itr;
    std::cout << std::distance(ranges::begin(S), itr) << " " << K - *itr << std::endl;
    return 0;
}
0