이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
#define X first
#define Y second
#define pb push_back
#define MAXN 20100
namespace JOI {
int n, m;
int a[MAXN], b[MAXN];
ll x;
int t;
vector<int> g[MAXN];
int tt = 0;
int bio[MAXN];
int usao[MAXN];
void dfs(int cv, int rod)
{
if (bio[cv]) return;
bio[cv] = 1;
usao[cv] = tt;
tt++;
MessageBoard(cv, !!(x & (1LL << ll(usao[cv] % 60))));
for (int i: g[cv]) {
if (rod != i) {
dfs(i, cv);
}
}
}
}
using namespace JOI;
void Joi(int N, int M, int A[], int B[], long long X, int T) {
n = N; m = M; x = X; t = T;
for(int i = 0; i < N; i++){
//MessageBoard(i, 0);
}
for (int i = 0; i < m; i++) {
a[i] = A[i];
b[i] = B[i];
g[a[i]].pb(b[i]);
g[b[i]].pb(a[i]);
}
dfs(0, -1);
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
#define X first
#define Y second
#define pb push_back
#define MAXN 20100
namespace IOI {
int n, m;
int a[MAXN], b[MAXN], par[MAXN];
int p, v;
int t;
vector<int> g[MAXN];
int tt = 0;
int bio[MAXN];
int usao[MAXN];
ll reza = 0LL;
int done[100], cnt = 0;
int calls = 0;
void dfs(int cv, int rod)
{
if (bio[cv]) return;
bio[cv] = 1;
usao[cv] = tt;
tt++;
par[cv] = rod;
for (int i: g[cv]) {
if (rod != i) {
dfs(i, cv);
}
}
}
void dfs2(int cv, int msg, int isrt)
{ if (calls > 120) return;
bio[cv] = 1;
int cu = usao[cv] % 60;
if (!done[cu]) {
cnt++;
done[cu] = 1;
reza |= ll(msg) * (1LL << ll(cu));
}
if (cnt == 60) return; if (calls > 120) return;
for (int i: g[cv]) {
if (i == par[cv]) continue;
if (bio[i]) continue;
calls++; if (calls > 120) return;
int nx = Move(i);
dfs2(i, nx, 0); if (calls > 120) return;
if (cnt == 60) return;
}
if (par[cv] != -1
//&& isrt
)
{
calls++; if (calls > 120) return;
int nx = Move(par[cv]);
dfs2(par[cv], nx, 1); if (calls > 120) return;
}
}
}
using namespace IOI;
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
n = N; m = M; p = P; v = V; t = T;
for (int i = 0; i < m; i++) {
a[i] = A[i];
b[i] = B[i];
g[a[i]].pb(b[i]);
g[b[i]].pb(a[i]);
}
dfs(0, -1);
memset(bio, 0, sizeof bio);
dfs2(p, v, 1);
//return 0LL;
return reza;
}
컴파일 시 표준 에러 (stderr) 메시지
Ioi.cpp: In function 'void IOI::dfs2(int, int, int)':
Ioi.cpp:49:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
49 | if (cnt == 60) return; if (calls > 120) return;
| ^~
Ioi.cpp:49:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
49 | if (cnt == 60) return; if (calls > 120) return;
| ^~
# | 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... |