Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <set>
- #include <string>
- #include <algorithm>
- using namespace std;
- using ll = long long;
- void cv(vector <int> v){
- for (auto x: v) cout<<x<<' ';
- cout<<'\n';
- }
- vector <ll> dx = {-1, 1, 0, 0};
- vector <ll> dy = {0,0,1,-1};
- vector <ll> cmd = {2, 1, 3, 0, 3, 1};
- ll sz = cmd.size();
- //up, down, R, L
- //перегородки
- vector <pair <ll, ll> > bdX(6, {100, 100});
- vector <pair <ll, ll> > bdY(6, {100, 100});
- bool bnd(ll x, ll y){//bound
- return x >= 0 && x < 6 && y >= 0 && y < 6;
- }
- bool free(ll x, ll y, ll x1, ll y1){
- bool can = 1;
- if (x == x1){
- //cout<<"ONE\n";
- if (bdX[x].first == min(y, y1) && bdX[x].second == max(y, y1)){
- //cout<<"THREE\n";
- can = 0;
- }
- }
- else if (y == y1){
- //cout<<"TWO\n";
- if (bdY[y].first == min(x, x1) && bdY[y].second == max(x, x1)){
- //cout<<"FOUR\n";
- can = 0;
- }
- }
- //cout<<"free = "<<can<<"\n";
- return can;
- }
- ll ans = 0;
- vector <pair <ll, ll> > good;
- bool gd(ll x, ll y, ll x1, ll y1){
- bool can = 0;
- return free(x, y, x1, y1) && bnd(x1, y1);
- }
- bool sh = 0;
- void go(ll x, ll y){
- ll x1 = x, y1 = y;
- ll cnt = 0;
- while (cnt < sz){
- //if (sh) cout<<x<<' '<<y<<'\n';
- ll dir = cmd[cnt];
- while (gd(x, y, x + dx[dir], y + dy[dir])){
- x += dx[dir];
- y += dy[dir];
- }
- cnt++;
- }
- if (x == 3 && y == 1){
- ans++;
- //good.push_back({x1, y1});
- }
- //if (sh) cout<<"\n\n";
- }
- int main()
- {
- /*ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);*/
- bdX[0] = {0,1};
- bdX[1] = {0,1};
- bdX[2] = {2,3};
- bdX[3] = {1,2};
- bdY[1] = {3,4};
- bdY[3] = {2,3};
- bdY[5] = {2,3};
- ll x0 = 3, y0 = 1;
- for (int i = 0; i < 6;++i){
- for (int j=0;j<6;++j){
- go(i, j);
- }
- }
- cout<<"ans= "<<ans<<"\n";
- /*sh = 1;
- for (auto g: good){
- //cout<<g.first<<' '<<g.second<<'\n';
- go(g.first, g.second);
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement