QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#248563#7743. Grand FinalecomeintocalmWA 1ms3576kbC++143.5kb2023-11-11 19:59:112023-11-11 19:59:12

Judging History

你现在查看的是最新测评结果

  • [2023-11-11 19:59:12]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3576kb
  • [2023-11-11 19:59:11]
  • 提交

answer

/**
 *          ┏┓    ┏┓
 *          ┏┛┗━━━━━━━┛┗━━━┓
 *          ┃       ┃  
 *          ┃   ━    ┃
 *          ┃ >   < ┃
 *          ┃       ┃
 *          ┃... ⌒ ...  ┃
 *          ┃              ┃
 *          ┗━┓          ┏━┛
 *          ┃          ┃ Code is far away from bug with the animal protecting          
 *          ┃          ┃   神兽保佑,代码无bug
 *          ┃          ┃           
 *          ┃          ┃        
 *          ┃          ┃
 *          ┃          ┃           
 *          ┃          ┗━━━┓
 *          ┃              ┣┓
 *          ┃              ┏┛
 *          ┗┓┓┏━━━━━━━━┳┓┏┛
 *           ┃┫┫       ┃┫┫
 *           ┗┻┛       ┗┻┛
 */ 
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<set>
#include<bitset>
#include<complex>
#include<assert.h>
#include<list>
#include<atomic>
#include <vector>
#include<memory>
#define inc(i,l,r) for(int i=l;i<=r;i++)
#define dec(i,l,r) for(int i=l;i>=r;i--)
#define link(x) for(edge *j=h[x];j;j=j->next)
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
#define eps 1e-8
#define succ(x) (1<<x)
#define mid (x+y>>1)
#define lowbit(x) (x&(-x))
#define sqr(x) (1ll*(x)*(x))
#define NM 305
#define nm 14005
using namespace std;
const double pi=acos(-1);
const int inf=1e9+7;
ll read(){
    ll x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return f*x;
}



struct edge{int t;edge*next;}e[nm],*h[NM],*o=e;
void add(int x,int y){o->t=y;o->next=h[x];h[x]=o++;}
int n,m;

struct plane{
    vector<int>a;
};
struct freg{
    vector<int>a;
};
queue<freg>q;
vector<plane>a;
vector<vector<int>>b;
stack<int>sta;
bool v[NM];
bool dfs(int x,int f){
    v[x]=true;
    sta.push(x);
    link(x)if(j->t!=f){
        if(!v[j->t]){
            if(dfs(j->t,x))return true;
        }else{
            plane p;
            while(sta.top()!=j->t){
                p.a.push_back(sta.top());
                sta.pop();
            }
            p.a.push_back(j->t);
            a.push_back(p);
            return true;
        }
    }
    return false;
}

int main(){
    n=read();m=read();
    b.resize(n);
    if(m>3*n-6)return 0*printf("NO\n");
    while(m--){
        int _x=read(),_y=read();
        add(_x,_y);add(_y,_x);
    }
    freg init;
    for(int i=1;i<=n;i++)init.a.push_back(i);
    q.push(std::move(init));
    bool _f=false;
    while(!q.empty()){
        freg&now=q.front();
        if(!_f){
            if(!dfs(1,0))return 0*printf("YES\n");
            a.push_back(a[0]);
            mem(v);
            for(int i:a[0].a)b[i].push_back(0),b[i].push_back(1);
        }else{

        }
        q.pop();
    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3576kb

input:

2
2 6
BG
BQWBWW
4 6
GQBW
WWWWQB

output:

NO

result:

wrong answer 1st lines differ - expected: '3', found: 'NO'