fork download
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n, time[100][2], q, ag[100][100];
  8. cin>>n;
  9. for(int i=0; i<n; i++)
  10. {
  11. cin>>time[i][0];
  12. //if(time[i][0]<10)
  13. //gotoxy(3,i+2);
  14. //else
  15. //gotoxy(4,i+2);
  16. cin>>time[i][1];
  17. }
  18.  
  19. cin>>q;
  20. for(int j=0; j<q; j++)
  21. {
  22. cin>>ag[j][0];
  23. int k=ag[j][0];
  24. for(int x=0, y=3; x<k; x++, y+=2)
  25. {
  26. if(ag[j][x]>9)
  27. y++;
  28. //gotoxy(y,n+3+j);
  29. cin>>ag[j][x+1];
  30. }
  31. }
  32.  
  33. cout<<endl<<endl;
  34. for(int m=0; m<q; m++)
  35. {
  36. int rec=0;
  37. for(int s=1; s<=ag[m][0]; s++)
  38. {
  39. for(int v=0; v<n; v++)
  40. {
  41. if((ag[m][s]>=time[v][0])&&(ag[m][s]<time[v][1]))
  42. rec++;
  43. }
  44. }
  45. cout<<rec<<endl;
  46. }
  47.  
  48.  
  49. return 0;
  50. }
Success #stdin #stdout 0s 3300KB
stdin
4
1 4
3 10
2 6
5 8
3
1 5
2 2 6
3 1 10 9
stdout

3
4
2