http://118.190.20.162/view.page?gpid=T112
第一次提交 60分,显示超时
#include <iostream> #include <cstdio> #include <cstring> #include <math.h> using namespace std; const int N = 22; const int K = 1000; struct point{ int x; int y; }; point points[N][K]; int times[N]; //bool visit[N]; int n, k, t, xl, yd, xr, yu; int main(){ scanf("%d %d %d %d %d %d %d", &n, &k, &t, &xl, &yd, &xr, &yu); point tmp; memset(times, 0, sizeof(times)); //memset(visit, false, sizeof(visit)); int pass = 0; int stay = 0; for(int i = 0; i < n; i++){ int maxt = 0; for(int j = 0; j < 2 * t; j += 2){ cin >> tmp.x >> tmp.y; points[i][j/2] = tmp; if(tmp.x >= xl && tmp.x <= xr && tmp.y >= yd && tmp.y <= yu){ times[i]++; if(maxt < times[i]) maxt = times[i]; }else{ times[i] = 0; } } if(maxt >= k){ stay++; pass++; //visit[i] == true; //printf("%d\n", i); }else if(maxt > 0){ pass++; //printf("%d\n", i); } } printf("%d\n%d\n", pass, stay); return 0; }