#include #include #include #include #include #include using namespace std; struct p{ int a; int b; }; int main() { int n; while(cin >>n) { vector

vstup; for(int i = 0; i> temp.a >> temp.b; vstup.push_back(temp); } int c; cin >> c; for(int i = 0; i< c; i++) { int time, count = 0; string action, what; cin >> action >> what >> time; int lo = -1, hi = vstup.size()-1; while(hi-lo>1) { int mid = (hi+lo)/2; if(vstup[mid].a>=time) hi = mid; else lo = mid; } int mi=vstup[hi].b,ma=vstup[hi].b; double avg=0.0; for(int i = 0; i<=hi; i++) { if(what == "min") { if(action == "lt") { if(vstup[i].b < mi) { count++; mi = vstup[i].b; } } else{ if(vstup[i].b<=mi) { mi = vstup[i].b; } else count++; } }else /* 10 60 30 120 28 180 35 240 34 300 40 360 31 420 28 480 2 540 42 600 30 6 gt avg 7200 lt min 300 gt max 300 lt max 300 lt avg 7200 gt min 300 */ if(what == "max") { if(action == "lt") { if(vstup[i].bma) { count++; ma = vstup[i].b; } } }else if(what == "avg") { avg += vstup[i].b; if(action == "lt") { if((double)vstup[i].bavg/(double)(i+1)) count++; } } } cout << count << "\n"; } } return 0; }