1 solutions
-
0
Guest MOD
-
0
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
#include <bits/stdc++.h> using namespace std;
const int N = 1e5+10;
int n,m; int a[N];
int main(){ cin >> n >> m; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); while(m--){ int w; cin >> w; int l = 0,r = n; while(l < r){ int mid = (l+r)/2; if(a[mid]<=w){ l = mid+1; }else{ r = mid; } } cout << l << endl; } return 0; }
- 1
Information
- ID
- 96
- Time
- 1000ms
- Memory
- 512MiB
- Difficulty
- 9
- Tags
- (None)
- # Submissions
- 32
- Accepted
- 2
- Uploaded By