結果

問題 No.3713 海底探索
ユーザー へきぼこ 競プロのすがた
提出日時 2026-09-12 11:05:39
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 823 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,341 ms
コンパイル使用メモリ 360,664 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-14 15:30:31
合計ジャッジ時間 3,761 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define oke cout << "Yes" << '\n';
#define dame cout << "No" << '\n';
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using Hai2 = vector<vector<ll>>;
using HaiW = vector<vector<pair<ll,ll>>>;
using HaiB = vector<vector<bool>>;
using Hai3 = vector<vector<vector<ll>>>;

int main() {
	cout << fixed << setprecision(15);
    ll N,A,B;
    cin>>N>>A>>B;
    vector<pair<ll,ll>>Z(N);
    rep(i,N){
        ll a,b;
        cin>>a>>b;
        Z[i]={b,a};
    }
    sort(all(Z));
    ll ans=0;
    ll a=0,b=0;
    rep(i,N){
        ll c,d;
        tie(d,c)=Z[i];
        if(a+c<=A && b+d<=B){
            ans++;
            a+=c;
            b+=d;
        }
    }
    cout<<ans<<endl;
}
0