# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
49203 | BThero | 철인 이종 경기 (APIO18_duathlon) | C++17 | 5 ms | 1088 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// Why am I so stupid? :c
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
typedef long long ll;
using namespace std;
vector <int> adj[105];
bool can[105];
bool u[105];
int n, m;
int ans;
void dfs(int v, int fn) {
if (v == fn) {
for (int i = 1; i <= n; ++i) {
can[i] |= u[i];
}
return;
}
u[v] = 1;
for (int to : adj[v]) {
if (u[to]) {
continue;
}
dfs(to, fn);
}
u[v] = 0;
}
void solve() {
scanf("%d %d", &n, &m);
for (int i = 1, u, v; i <= m; ++i) {
scanf("%d %d", &u, &v);
adj[u].pb(v);
adj[v].pb(u);
}
for (int a = 1; a <= n; ++a) {
for (int b = 1; b <= n; ++b) {
if (a == b) {
continue;
}
dfs(a, b);
for (int i = 1; i <= n; ++i) {
ans += can[i];
can[i] = 0;
}
--ans;
}
}
printf("%d\n", ans);
}
int main() {
#ifdef BThero
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // BThero
int tt = 1;
while (tt--) {
solve();
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |
# | 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... |