『Fwb』Round 1 之冬日绚礼 T3 求条
  • 板块学术版
  • 楼主nightwatch.ryan
  • 当前回复2
  • 已保存回复2
  • 发布时间2025/1/19 18:00
  • 上次更新2025/1/19 20:42:48
查看原帖
『Fwb』Round 1 之冬日绚礼 T3 求条
961351
nightwatch.ryan楼主2025/1/19 18:00

rt. 20pts https://www.luogu.com.cn/record/199273816

#include<bits/stdc++.h>
#define int long long
using namespace std;
#define P(i, a, b) for(int i = a; i <= b; i++)
#define Q(i, a, b) for(int i = a; i >= b; i--)
const int maxn = 25;
const int inf = 0x3f3f3f3f;
int t, n;
struct Player{
    int id;
    int type;
    bool isUse[maxn];
    bool isDead;
    bool du;
    bool jie; 
    int deadtime;
    int deadcnt;
    int hunter_cnt;
}p[maxn], lst[maxn];
bool isValidId(int x){
    return (x >= 1 && x <= n);
}
signed main(){
    cin.tie(0)->sync_with_stdio(0);
    cin >> t >> n;
    P(i, 1, n){
        cin >> p[i].type;
        p[i].id = i;
    }
    P(i, 1, t){
        int m;
        cin >> m;
        bool isWrong = 0;
        vector<int> deadlist;
        while(m --){
            int T; 
            cin >> T;
            int id1, id2;
            cin >> id1 >> id2;
            if(p[id1].type == 2 || !isValidId(id1) || !isValidId(id2)) isWrong = true;
            if(!isWrong){
                if(T == 0){
                    if( p[id1].isUse[i]       || 
                        id1 == id2            || 
                        p[id1].isDead         ||
                        p[id2].isDead         ||
                        p[id1].type != 1      ){
                        isWrong = true;
                        continue;
                    }
                    p[id1].isUse[i] = 1;
                    p[id2].isDead = 1;
                    p[id2].deadtime = i;
                    p[id2].deadcnt ++;
                }else if(T == 1){
                    if( p[id1].isUse[i]       || 
                        p[id1].du             ||
                        id1 == id2            || 
                        p[id1].isDead         ||
                        p[id2].isDead         ||
                        p[id2].deadtime != 0  ||
                        p[id1].type != 4      ){
                        isWrong = true;
                        continue;
                    }
                    p[id1].isUse[i] = 1;
                    p[id1].du = 1;
                    p[id2].isDead = 1;
                    p[id2].deadtime = i;
                    p[id2].deadcnt ++;
                }else if(T == 2){
                    if( p[id1].isUse[i]       || 
                        p[id1].jie            ||
                        !p[id2].isDead        ||
                        p[id2].deadtime != i  ||
                        p[id1].type != 4      ){
                        isWrong = true;
                        continue;
                    }
                    p[id1].jie = 1;
                    p[id1].isUse[i] = 1;
                    p[id2].isDead = 0;
                    p[id2].deadtime = 0;
                    if(p[id2].type == 3){
                        p[id2].isUse[i] = 0;
                    }
                }else{
                    if( p[id2].isDead          ||
                        !p[id1].isDead         ||
                        p[id1].deadtime != i   ||
                        id1 == id2             ||
                        p[id1].type != 3       ||
                        p[id1].isUse[i]){
                        isWrong = true;
                        continue;
                    }
                    p[id2].isDead = 1;
                    p[id2].deadtime = i;
                    p[id1].isUse[i] = 1;
                    p[id2].deadcnt ++;
                    p[id1].hunter_cnt ++;
                }
            }
        }
        P(j, 1, n)
         if(p[j].type == 3 && p[j].hunter_cnt != p[j].deadcnt){
            isWrong = true; break;
         }
        P(j, 1, n)
         if(p[j].isDead && p[j].deadtime == i)
          deadlist.push_back(j);
        if(isWrong) cout << "Wrong\n";
        else if(!deadlist.size()) cout << "Safe\n";
        else{
         cout << deadlist.size() << " ";
         for(int j = 0; j < deadlist.size(); j ++) 
          cout << deadlist[j] << " ";
         cout << endl;
        }
        if(isWrong) P(j, 1, n) p[j] = lst[j];
        else P(j, 1, n) lst[j] = p[j];
    }
}
2025/1/19 18:00
加载中...