Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define pb push_back
  3.  
  4. typedef long long ll;
  5. const int N = 1e5+10;
  6. const int oo = 1e9;
  7.  
  8. using namespace std;
  9. int n,m,c,s;
  10. vector<int> re;
  11. int q;
  12.  
  13.  
  14. int main(){
  15. #ifndef ONLINE_JUDGE
  16. freopen("in.txt","r",stdin);
  17. #endif
  18. cin >> n >> m >> c;
  19.  
  20. for(int i=0;i<m;i++){
  21. scanf("%d",&s);
  22. re.pb(s);
  23. }
  24. sort(re.begin(),re.end());
  25. cin >> q;
  26. for(int i=0;i<q;i++){
  27. scanf("%d",&s);
  28. int lo = (lower_bound (re.begin(), re.end(), s)) - re.begin();
  29. cout << (s - lo)%c << " " <<(s - lo)/c << endl ;
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement