#include #include #include #include #include #include using namespace std; #define pii pair #define pb push_back #define mp make_pair #define piii pair,int> int board[26][26]={0},n; void removesHeretoredValues(){ for(int i=0;i= 0 && position.first < n && position.second >= 0 && position.second < n); } bool isFree(pii position){ if(board[position.first][position.second]==0){ board[position.first][position.second]=1; return true; } return false; } vector knight(pii position,int *rs,int *cs){ vector result; int r, c; for(int i=0;i<8;i++) { r = position.first + rs[i]; c = position.second + cs[i]; auto p = mp(r, c); if(isInBoard(p)){ if(isFree(p)){ result.pb(p); } } } return result; } int findMinimumPoints(int step1,int step2){ int rs[]={(1*step1),(1*step2),(1*step2),(1*step1),(-1*step1),(-1*step2),(-1*step2),(-1*step1)}; int cs[]={(-1*step2),(-1*step1),(1*step1),(1*step2),(1*step2),(1*step1),(-1*step1),(-1*step2)}; auto p=mp(0,0); queue positionitionStoreHere; positionitionStoreHere.push(mp(p,0)); while(!positionitionStoreHere.empty()){ auto split=positionitionStoreHere.front(); auto position=split.first; auto movedStepsHere=split.second; movedStepsHere++; vector movesHere=knight(position,rs,cs); int numberOfElements=movesHere.size(); for(int i=0;i positionitionStoreHere; positionitionStoreHere.push(mp(p,0)); while(!positionitionStoreHere.empty()){ auto split=positionitionStoreHere.front(); auto position=split.first; auto movedStepsHere=split.second; movedStepsHere++; vector movesHere=knight(position,rs,cs); int numberOfElements=movesHere.size(); for(int i=0;i>n; int result[27][27]; for(int i=1;i>testCase; int hashTable[6]={0}; while(testCase--){ int value; cin>>value; hashTable[value]++; } int maxValue=0,indexPosition=0; for(int index=1;index<6;index++){ if(hashTable[index]>maxValue){ maxValue=hashTable[index]; indexPosition=index; } } cout<> s >> t >> a >> b >> m >> n; for(int i=0;i>d; d = a+d; if(d>=s && d<=t) ans1++; } for(int i=0;i>d; d = b+d; if(d>=s && d<=t) ans2++; } cout << ans1 << endl; cout << ans2 << endl; return 0; }