提出 #70779373


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

// // Optional: Policy-based DS (comment to disable)
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// template<typename T>
// using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


// // Optional: File I/O
// ifstream input_file("input.txt");
// ofstream output_file("output.txt");
// #define cin input_file
// #define cout output_file

// -------------------- Type Aliases --------------------
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

// -------------------- Macros --------------------
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define endl '\n'
#define SUM(v) accumulate(all(v), 0LL)
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))

// -------------------- Constants --------------------
constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 5;

// -------------------- Overloads --------------------
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for (const auto& x : v) os << x << ' ';
    return os;
}

template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (auto& x : v) is >> x;
    return is;
}

template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << '(' << p.ff << ", " << p.ss << ')';
}

template<typename T>
ostream& operator<<(ostream& os, const set<T>& s) {
    for (auto& x : s) os << x << ' ';
    return os;
}

template<typename K, typename V>
ostream& operator<<(ostream& os, const map<K, V>& m) {
    for (auto& [k, v] : m) os << '{' << k << ": " << v << "} ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    for (const auto& row : v) {
        for (const auto& val : row) os << val << ' ';
        os << '\n';
    }
    return os;
}

template<typename T>
istream& operator>>(istream& is, vector<vector<T>>& v) {
    for (auto& row : v)
        for (auto& val : row)
            is >> val;
    return is;
}


// -------------------- Debug (Optional) --------------------
/*
#define dbg(x) cerr << #x << " = " << x << endl;
*/

// -------------------- Math Utilities --------------------
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll mod_add(ll a, ll b, ll m = MOD) { return (a + b) % m; }
ll mod_sub(ll a, ll b, ll m = MOD) { return (a - b + m) % m; }
ll mod_mul(ll a, ll b, ll m = MOD) { return (a * b) % m; }

ll mod_pow(ll base, ll exp, ll m = MOD) {
    ll res = 1;
    base %= m;
    while (exp > 0) {
        if (exp & 1) res = mod_mul(res, base, m);
        base = mod_mul(base, base, m);
        exp >>= 1;
    }
    return res;
}

ll mod_inv(ll a, ll m = MOD) {
    return mod_pow(a, m - 2, m); // Fermat (MOD must be prime)
}

// -------------------- Grid Directions --------------------
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
// or use: {{0,1},{1,0},{0,-1},{-1,0}} for 2D

// -------------------- Comparators --------------------
auto desc = [](auto a, auto b) { return a > b; };

// -------------------- Solver --------------------
void solve() {
    ll n,m,k; cin>>n>>m>>k;
    vll h(n); cin>>h;
    ll cnt = 0;
    sort(all(h));
    multiset<ll> msb;
    for(int i=0; i<m; ++i) {
        ll x; cin>>x;
        msb.insert(x);
    }
    for(int i=0; i<n; ++i) {
        auto it = msb.lower_bound(h[i]);
        if(it == msb.end()) break;
        cnt++;
        if(cnt >= k) break;
        msb.erase(it);
    }
    cout<< (cnt >= k ? "Yes" : "No") ;
}

// -------------------- Main --------------------
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;
    for (int tc = 1; tc <= t; ++tc) {
        // cout << "Case #" << tc << ": ";
        solve();
    }

    return 0;
}

提出情報

提出日時
問題 C - Robot Factory
ユーザ yalrnr
言語 C++23 (GCC 15.2.0)
得点 300
コード長 4273 Byte
結果 AC
実行時間 92 ms
メモリ 14360 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 4
AC × 35
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3456 KiB
00_sample_01.txt AC 1 ms 3464 KiB
00_sample_02.txt AC 1 ms 3544 KiB
00_sample_03.txt AC 1 ms 3396 KiB
01_random_03.txt AC 86 ms 14188 KiB
01_random_04.txt AC 87 ms 14256 KiB
01_random_05.txt AC 88 ms 14292 KiB
01_random_06.txt AC 87 ms 14144 KiB
01_random_07.txt AC 87 ms 14256 KiB
01_random_08.txt AC 87 ms 14264 KiB
01_random_09.txt AC 87 ms 14252 KiB
01_random_10.txt AC 87 ms 14252 KiB
01_random_11.txt AC 88 ms 14252 KiB
01_random_12.txt AC 32 ms 8084 KiB
01_random_13.txt AC 48 ms 9904 KiB
01_random_14.txt AC 70 ms 12476 KiB
01_random_15.txt AC 31 ms 8836 KiB
01_random_16.txt AC 28 ms 7892 KiB
01_random_17.txt AC 14 ms 4888 KiB
01_random_18.txt AC 90 ms 14360 KiB
01_random_19.txt AC 87 ms 14244 KiB
01_random_20.txt AC 92 ms 14304 KiB
01_random_21.txt AC 92 ms 14228 KiB
01_random_22.txt AC 92 ms 14264 KiB
01_random_23.txt AC 48 ms 10464 KiB
01_random_24.txt AC 3 ms 4104 KiB
01_random_25.txt AC 84 ms 13720 KiB
01_random_26.txt AC 87 ms 14252 KiB
01_random_27.txt AC 86 ms 14244 KiB
01_random_28.txt AC 85 ms 14256 KiB
01_random_29.txt AC 87 ms 14292 KiB
01_random_30.txt AC 88 ms 14256 KiB
01_random_31.txt AC 47 ms 10068 KiB
01_random_32.txt AC 68 ms 12396 KiB
01_random_33.txt AC 52 ms 10516 KiB