QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#93212 | #996. 割点 | tsawke# | WA | 7ms | 8420kb | C++14 | 2.6kb | 2023-03-31 14:48:23 | 2023-03-31 14:48:24 |
Judging History
answer
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define PI M_PI
#define E M_E
#define npt nullptr
#define SON i->to
#define OPNEW void* operator new(size_t)
#define ROPNEW void* Edge::operator new(size_t){static Edge* P = ed; return P++;}
#define ROPNEW_NODE void* Node::operator new(size_t){static Node* P = nd; return P++;}
using namespace std;
mt19937 rnd(random_device{}());
int rndd(int l, int r){return rnd() % (r - l + 1) + l;}
bool rnddd(int x){return rndd(1, 100) <= x;}
typedef unsigned int uint;
typedef unsigned long long unll;
typedef long long ll;
typedef long double ld;
template < typename T = int >
inline T read(void);
int N, M;
struct Edge{
Edge* nxt;
Edge* rev;
int to;
OPNEW;
}ed[1100000];
ROPNEW;
Edge* head[510000];
bitset < 510000 > inS;
int dfn[510000], low[510000];
struct edge{int s, t;};
basic_string < edge > edgs;
set < int > pt;
int main(){
N = read(), M = read();
for(int i = 1; i <= M; ++i){
int s = read(), t = read();
if(s == t)continue;
edgs += {s, t};
head[s] = new Edge{head[s], npt, t};
head[t] = new Edge{head[t], npt, s};
head[s]->rev = head[t], head[t]->rev = head[s];
}
auto Tarjan = [](auto&& self, int p, int rt, Edge* fa = npt)->void{
static stack < int > cur;
static int cdfn(0);
dfn[p] = low[p] = ++cdfn;
cur.push(p), inS[p] = true;
int cnt_rt(0);
for(auto i = head[p]; i; i = i->nxt){
// printf("in dfs p = %d, son = %d\n", p, SON);
if(!dfn[SON]){
self(self, SON, rt, i->rev);
low[p] = min(low[p], low[SON]);
if(p != rt && low[SON] >= dfn[p])pt.insert(p);
}else if(i != fa)low[p] = min(low[p], dfn[SON]);
if(p == rt)++cnt_rt;
}
// printf("p = %d, cnt = %d\n", p, cnt_rt);
if(p == rt && cnt_rt >= 2)pt.insert(p);
};
for(int i = 1; i <= N; ++i)if(!dfn[i])Tarjan(Tarjan, i, i);
for(auto p : pt)printf("%d\n", p);
// for(auto edg : edgs)if((bridge.count({edg.s, edg.t}) || bridge.count({edg.t, edg.s})))printf("%d %d\n", edg.s, edg.t);
// printf("%d\n", (int)bridge.size());
fprintf(stderr, "Time: %.6lf\n", (double)clock() / CLOCKS_PER_SEC);
return 0;
}
template < typename T >
inline T read(void){
T ret(0);
int flag(1);
char c = getchar();
while(c != '-' && !isdigit(c))c = getchar();
if(c == '-')flag = -1, c = getchar();
while(isdigit(c)){
ret *= 10;
ret += int(c - '0');
c = getchar();
}ret *= flag;
return ret;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 7ms
memory: 8420kb
input:
12783 21968 4933 7832 8238 2739 3628 7841 9169 6390 7850 8797 8120 8710 5306 9807 10166 2063 2666 5157 5015 4651 4790 12586 10366 7137 12440 7218 6330 3670 2735 8492 1968 2750 6237 1112 6578 9221 743 3820 7155 4583 2537 9747 11331 9916 4454 5631 2978 10340 5293 1803 4944 4296 11800 2742 7903 2018 10...
output:
1 13 22 26 27 29 33 35 37 39 45 47 53 62 78 91 118 127 132 144 151 155 156 163 166 168 177 183 187 192 194 196 205 219 220 223 225 239 248 250 254 256 265 285 290 313 315 337 338 347 356 358 376 386 388 408 414 415 427 446 459 461 464 477 486 504 513 519 538 555 557 571 574 608 611 619 625 626 633 6...
result:
wrong answer 1st numbers differ - expected: '1440', found: '1'