• 【codeforces 812A】Sagheer and Crossroads


    【题目链接】:http://codeforces.com/contest/812/problem/A

    【题意】

    有一个小箭头指的那个地方;
    指的就是人行道路;
    然后p[i]指的就是那4个人行道是不是绿灯;
    然后问你会不会发生事故;

    【题解】

    根据每一个p值是不是1;
    判断其他地方的车会不会到这个人行道上来就好;

    【Number Of WA

    1

    【完整代码】

    #include <bits/stdc++.h>
    using namespace std;
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define LL long long
    #define rep1(i,a,b) for (int i = a;i <= b;i++)
    #define rep2(i,a,b) for (int i = a;i >= b;i--)
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define ms(x,y) memset(x,y,sizeof x)
    #define Open() freopen("F:\rush.txt","r",stdin)
    #define Close() ios::sync_with_stdio(0),cin.tie(0)
    
    typedef pair<int,int> pii;
    typedef pair<LL,LL> pll;
    
    const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
    const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
    const double pi = acos(-1.0);
    const int N = 110;
    
    int l[5],s[5],r[5],p[5];
    
    void out(){
        cout <<"YES"<<endl;
        exit(0);
    }
    
    int main(){
        //Open();
        Close();//scanf,puts,printf not use
        //init??????
        rep1(i,1,4){
            cin >> l[i] >> s[i] >> r[i] >> p[i];
        }
        if (p[1]==1){
            if (l[1] || s[1] || r[1] || l[2] || s[3] || r[4])
                out();
        }
        if (p[2]==1){
            if (l[2] ||s[2] || r[2] || l[3] || s[4] || r[1]) out();
        }
        if (p[3]==1){
            if (l[3] ||s[3] || r[3] || l[4] || s[1] || r[2]) out();
        }
        if (p[4]==1){
            if (l[4] || s[4] || r[4] || l[1] || s[2] || r[3]) out();
        }
        cout <<"NO"<<endl;
        return 0;
    }
  • 相关阅读:
    【算法】数据结构
    【POJ】1222 EXTENDED LIGHTS OUT
    【BZOJ】1013 [JSOI2008]球形空间产生器sphere
    【有上下界网络流】【ZOJ】2314 Reactor Cooling
    【CODEVS】1281 Xn数列
    【POJ】3070 Fibonacci
    【CODEVS】3546 矩阵链乘法
    【BZOJ】1070: [SCOI2007]修车
    Quoit Design(hdu 1007)
    tree(poj 1741)
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7626289.html
Copyright © 2020-2023  润新知