Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
using namespace std; int n,m,d; long long x[100005],c[100005]; bool f(long long koj, long long kolku) { for(int i = 0; i < koj; i++) { kolku -= max(0LL, c[i] - x[n - koj + i]); if(kolku < 0) { return 0; } } return 1; } int main() { cin>>n>>m>>d; for(int i=0;i
>x[i]; } for(int i=0;i
>c[i]; } sort(x,x +n); sort(c,c +m); int l=0; int r=min(n, m); int mid=(l+r)/2; int maxx = 0; while(l<=r) { mid=(l+r)/2; bool ok=f(mid, d); if(ok) { maxx = max(maxx, mid); l=mid+1; } if(!ok) { r=mid-1; } } mid = maxx; cout<
=0) { cout<
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)