Advertisement
a53

Low_Mem

a53
Jan 1st, 2022
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. /*
  2.  
  3. Pirnog Theodor Ioan
  4. Colegiul National "B. P. Hasdeu"
  5.  
  6. */
  7.  
  8. #include <fstream>
  9.  
  10. using namespace std;
  11.  
  12. ifstream cin1("lowmem.in");
  13. ifstream cin2("lowmem.in");
  14. ofstream cout("lowmem.out");
  15.  
  16. int n, k, x, l, ans, t;
  17.  
  18. int main(){
  19.  
  20. cin1 >> n >> k;
  21. for(int i = 1; i <= n; i++){
  22.  
  23. cin1 >> x;
  24. t = x;
  25.  
  26. }
  27.  
  28. cin2 >> n >> k;
  29.  
  30. for(int i = 1; i <= n; i++){
  31.  
  32. cin2 >> x;
  33.  
  34. if(x <= t)
  35. l++;
  36. else{
  37.  
  38.  
  39. if(l >= k)
  40. ans += l - k + 1;
  41.  
  42. l = 0;
  43. }
  44.  
  45. }
  46.  
  47. if(l >= k)
  48. ans += l - k + 1;
  49.  
  50. cout << ans;
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement