제출 #1272506

#제출 시각아이디문제언어결과실행 시간메모리
1272506goulthenTopical (NOI23_topical)C++20
33 / 100
213 ms16228 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define rep(i,a,b) for (int i = a; i <= b; i++) #define per(i,a,b) for (int i = a; i >= b; i--) #define fi first #define se second #define pii pair<int,int> #define pb push_back #define all(v) (v).begin(), (v).end() const int MAXN = 1e6+10; const int INF = 1e18 + 5; const int MOD = 1e9+7; pii a[MAXN]; void solve() { int n,k;cin >> n >> k; rep(i,1,n) cin >> a[i].fi; rep(i,1,n) cin >> a[i].se; sort(a+1,a+n+1); int cur = 0, ans = 0; rep(i,1,n) { if(a[i].fi <= cur) cur += a[i].se,ans++; } cout << ans << '\n'; } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); int tt = 1; //cin >> tt; while (tt--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...