이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ii = pair<ll, ll>;
using vi = vector<int>;
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define lb lower_bound
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
const int oo = 1e18 + 7;
int N; int vis[1000001];
vector<int> adj[1000001];
void Init(int n) { N = n; }
void Link(int a, int b) {
adj[a].pb(b), adj[b].pb(a);
}
bool dfs(int v, int p) {
if(vis[v]) return 0;
int children = 0; vis[v] = 1; bool ok = 1;
for(auto u : adj[v]) {
if(vis[u] == 2 || u == p) continue;
children++; ok &= dfs(u, v);
}
if(v == p) return (ok && children <= 2);
return (ok && children <= 1);
}
int CountCritical() {
int res = 0;
for(int l = 0; l < N; l++) {
vis[l] = 2; bool ok = 1;
for(int i = 0; i < N; i++) {
if(vis[i]) continue;
ok &= dfs(i, i);
}
res += ok; fill(vis, vis + N, 0);
}
return res;
}
컴파일 시 표준 에러 (stderr) 메시지
rings.cpp:20:29: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
20 | const int oo = 1e18 + 7;
| ~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |