QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#791710#997. 2-SAT 问题MiniLongWA 40ms38852kbC++141.8kb2024-11-28 20:30:292024-11-28 20:30:29

Judging History

This is the latest submission verdict.

  • [2024-11-28 20:30:29]
  • Judged
  • Verdict: WA
  • Time: 40ms
  • Memory: 38852kb
  • [2024-11-28 20:30:29]
  • Submitted

answer

#include <bits/stdc++.h>
#define _rep(i, x, y) for(int i = x; i <= y; ++i)
#define _req(i, x, y) for(int i = x; i >= y; --i)
#define fi first
#define se second
#define pb push_back
#define mst(f, i) memset(f, i, sizeof f)
#define multitest() int T; read(T); for(int tCase = 1; tCase <= T; ++tCase)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
namespace fastio{
    template<typename T> inline void read(T &t){
        T x = 0, f = 1;
        char c = getchar();
        while(!isdigit(c)){
            if(c == '-') f = -f;
            c = getchar();
        }
        while(isdigit(c)) x = x * 10 + c - '0', c = getchar();
        t = x * f;
    }
    template<typename T, typename ... Args> inline void read(T &t, Args &...args){
        read(t), read(args...);
    }
}
using namespace fastio;
const int N = 1e6 + 5;
int n, m;
vector<int> G[N];
int id, num, dfn[N], low[N], scc[N];
int top, st[N];
bool vis[N];
void tarjan(int u, int fa){
    dfn[u] = low[u] = ++id;
    st[++top] = u, vis[u] = 1;
    for(auto &v : G[u]){
        if(!dfn[v]){
            tarjan(v, u);
            low[u] = min(low[u], low[v]);
        }else if(vis[v]) low[u] = min(low[u], dfn[v]);
    }
    if(low[u] == dfn[u]){
        num++;
        for(int x = 0; x != u; top--){
            x = st[top], vis[x] = 0;
            scc[x] = num;
        }
    }
}
int main(){
    read(n, m);
    _rep(i, 1, m){
        int u, a, v, b; read(u, a, v, b);
        G[u + (!a) * n].pb(v + b * n);
        G[v + (!b) * n].pb(u + a * n);
    }
    _rep(i, 1, 2 * n) if(!dfn[i]) tarjan(i, 0);
    _rep(i, 1, n) if(scc[i] == scc[i + n]) return puts("No"), 0;
    puts("Yes");
    _rep(i, 1, n) printf("%d ", low[i] < low[i + n] ? 0 : 1); puts("");
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 40ms
memory: 38852kb

input:

86354 86418
14615 0 14903 1
13605 0 4458 0
15604 0 77112 0
52311 1 64996 0
22711 1 74245 1
39042 1 57372 1
2994 1 84183 1
80574 0 58791 1
27780 1 9336 1
61809 0 7216 0
71113 0 42287 1
20073 0 72448 0
73840 0 77048 0
28955 0 4165 0
16322 1 14075 1
43512 0 58600 1
45219 0 53858 0
14919 0 22576 0
16594...

output:

Yes
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

wrong answer Your plan didn't satisfy condition #28436.(i = 13165, a = 0, j = 2164, b = 1)