fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #include <ext/pb_ds/assoc_container.hpp>
  5. #include <ext/pb_ds/tree_policy.hpp>
  6. using namespace __gnu_pbds;
  7. typedef tree<ll, null_type, greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
  8. #define ff first
  9. #define ss second
  10. #define pb push_back
  11. const int N=3e5+7;
  12. ll mod=1e9+7;
  13. ll ax[8]={0,0,-1,+1,-1,-1,1,1};
  14. ll ay[8]={-1,1,0,0,-1,1,-1,1};
  15. ll kx[8]={2,2,-2,-2,1,1,-1,-1};
  16. ll ky[8]={1,-1,1,-1,2,-2,2,-2};
  17.  
  18. int main(){
  19. ios::sync_with_stdio(0);
  20. cin.tie(0);
  21. ll t=1;
  22. //cin>>t;
  23. while(t--){
  24. ll i,j,n,k,s=0,m;
  25. cin>>n>>k;
  26. ordered_set st;
  27. ll a[n];
  28. for(i=0;i<n;i++){
  29. cin>>a[i];
  30. st.insert(a[i]);
  31. }
  32. ll ans=0;
  33. st.insert(0);
  34. for(i=0;i<k;i++){
  35. cin>>s;
  36. cout<<i<<" "<<k<<" "<<s<<" "<<st.order_of_key(s)<<"\n";
  37. }
  38. }
  39. return 0;
  40. }
Success #stdin #stdout 0.01s 5284KB
stdin
7 5
1 2 3 4 5 5 5
1 2 3 4 5
stdout
0 5 1 6
1 5 2 5
2 5 3 4
3 5 4 3
4 5 5 0