Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. const int maxtan = 100;
  8. const int maxver = 100;
  9. const int maxpon = 50;
  10. int N = 0;
  11. int M = 0;
  12. cin >> N;
  13. cin >> M;
  14. int minp[maxpon];
  15. int resztv[maxver];
  16. int szam[maxver][maxtan];
  17. int pont[maxver][maxtan];
  18. bool siker[maxver][maxtan];
  19.  
  20. for (int i = 0; i < M; i++)
  21. {
  22. cin >> minp[i];
  23. }
  24. for (int i = 0; i < M; i++)
  25. {
  26. cin >> resztv[i];
  27. for (int j = 0; j < resztv[i]; j++)
  28. {
  29. cin >> szam[i][j];
  30. cin >> pont[i][j];
  31. }
  32. }
  33.  
  34. int resztv2[M];
  35.  
  36. for (int i = 0; i < M; i++)
  37. {
  38. resztv2[i] = 0;
  39. for (int j = 0; j < resztv[i]; j++)
  40. {
  41. if ( pont[i][j] >= minp[i] )
  42. {
  43. resztv2[i] = resztv2[i] + 1;
  44. siker[i][j] = true;
  45. }
  46. else
  47. {
  48. siker[i][j] = false;
  49. }
  50. }
  51. }
  52.  
  53. for (int i = 0; i < M; i++)
  54. {
  55. cout << resztv2[i];
  56. for (int j = 0; j < resztv[i]; j++)
  57. {
  58. if ( siker[i][j] == true)
  59. {
  60. cout << " " << szam[i][j];
  61. }
  62. }
  63. cout << endl;
  64. }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement