Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
codeforce - BerSU Ball
jakaria_hossain
Dec 12th, 2019
145
Never
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
C++
0.58 KB
raw
download
clone
embed
print
report
RAW Paste Data
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll m,n; cin>>n; ll boy[n+1]; for(ll i=0;i<n;i++)cin>>boy[i]; cin>>m; ll girl[m]; for(ll i=0;i<m;i++)cin>>girl[i]; sort(boy,boy+n); sort(girl,girl+m); ll i=0,j=0,c=0; while(i<n && j<m) { if(abs(boy[i]-girl[j])<=1) { //cout<<"test "<<boy[i]<<" "<<girl[j]<<endl; c++; i++; j++; } else if(girl[j]<boy[i])j++; else i++; } cout<<c<<endl; }
Public Pastes
triangles
JavaScript | 28 min ago
Roof+
Lua | 30 min ago
Untitled
PHP | 1 hour ago
Untitled
Java | 1 hour ago
Untitled
Java | 1 hour ago
celery
Python | 1 hour ago
Arr
C# | 1 hour ago
My Log File
HTML 5 | 1 hour ago
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!