Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <sstream>
- #include <string>
- #include <vector>
- #include <queue>
- #include <set>
- #include <map>
- #include <cstdio>
- #include <cstdlib>
- #include <cctype>
- #include <cmath>
- using namespace std;
- typedef long long LL;
- #define FOR(k,a,b) for(int k(a); k < (b); ++k)
- #define REP(k,a) for(int k=0; k < (a); ++k)
- class YetAnotherIncredibleMachine {
- public:
- int countWays(vector <int> platformMount, vector <int> platformLength, vector <int> balls) {
- int n=platformMount.size();
- int b=balls.size();
- LL res=1;
- LL mod=1000000009;
- REP(i,n)
- {
- int ctr=0;
- FOR(j,-1*platformLength[i],1)
- {
- bool ok=true;
- REP(k,b)
- {
- if(balls[k]>=platformMount[i]+j && balls[k]<=platformMount[i]+j+platformLength[i])
- {
- ok=false;
- break;
- }
- }
- if(ok)
- ++ctr;
- }
- res*=ctr;
- res%=mod;
- }
- return res;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment