1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| #include<iostream> #include<cmath> #include<algorithm> #include<vector>
using namespace std;
int main() { int n,k,t,xl,yd,xr,yu; int tg = 0,dl=0; cin >> n >> k >> t >> xl >> yd >> xr >>yu; for(int j = 0;j<n;j++) { int tmp1, tmp2, num = 0, judge = 0; for (int i = 0; i < t; i++) { cin >> tmp1 >> tmp2; if ((tmp1 >= xl && tmp1 <= xr) && (tmp2 >= yd && tmp2 <= yu)) { if (judge == 0) { tg++; } if(judge != 2) { num++, judge = 1; } } else { num = 0; } if (num >= k && judge ==1) { dl++,judge = 2; } } } cout << tg << endl; cout << dl <<endl; return 0; }
|