이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "Joi.h"
using namespace std;
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
static ll mod=1000000007;
static int inf=1000000007;
static ll infl=1000000000000000007;
static const int N=10007;
static bool odw[N];
static vector<int>G[N],G1[N];
static vector<int>X[N];
static int id[N];
static vector<int>V;
static void dfs(int v)
{
if(sz(V)<60)
{
id[v]=sz(V);
V.pb(v);
}
odw[v]=1;
for(auto u:G[v])
{
if(!odw[u])
{
G1[u].pb(v);
G1[v].pb(u);
dfs(u);
}
}
}
static bool is[N];
static void dfs1(int v,int o)
{
for(auto u:G1[v])
{
if(u==o) continue;
if(sz(X[u])==0)
{
int l=-1;
for(auto i:X[v]) is[i]=1;
for(auto i:X[v])
{
int c=0;
for(auto j:G1[i]) c+=is[j];if(c==1&&i!=o) l=i;
}
id[u]=id[l];
for(auto i:X[v])
{
is[i]=0;
if(i!=l) X[u].pb(i);
}
X[u].pb(u);
}
dfs1(u,v);
}
}
void Joi(int n, int m, int A[], int B[], ll x, int tt)
{
for(int i=0;i<m;i++)
{
G[A[i]].pb(B[i]);
G[B[i]].pb(A[i]);
}
dfs(0);
for(auto x:V) X[x]=V;
dfs1(0,-1);
for(int i=0;i<n;i++) MessageBoard(i,((1LL<<id[i])&x)>0);
}
#include <bits/stdc++.h>
#include "Ioi.h"
using namespace std;
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
static ll mod=1000000007;
static int inf=1000000007;
static ll infl=1000000000000000007;
const static int N=10007;
static bool odw[N];
static vector<int>G[N],G1[N];
static vector<int>X[N];
static int id[N];
static vector<int>V;
static void dfs(int v)
{
if(sz(V)<60)
{
id[v]=sz(V);
V.pb(v);
}
odw[v]=1;
for(auto u:G[v])
{
if(!odw[u])
{
G1[u].pb(v);
G1[v].pb(u);
dfs(u);
}
}
}
static bool is[N];
static void dfs1(int v,int o)
{
for(auto u:G1[v])
{
if(u==o) continue;
if(sz(X[u])==0)
{
int l=-1;
for(auto i:X[v]) is[i]=1;
for(auto i:X[v])
{
int c=0;
for(auto j:G1[i]) c+=is[j];if(c==1&&i!=o) l=i;
}
id[u]=id[l];
for(auto i:X[v])
{
is[i]=0;
if(i!=l) X[u].pb(i);
}
X[u].pb(u);
}
dfs1(u,v);
}
}
static ll ans=0;
static void dfs2(int v,int o)
{
for(auto u:G1[v])
{
if(u==o||!is[u]) continue;
ll x=Move(u);
ans+=x*(1LL<<id[u]);
dfs2(u,v);
}
if(o!=-1) Move(o);
}
ll Ioi(int n, int m, int A[], int B[], int p, int v, int t)
{
for(int i=0;i<m;i++)
{
G[A[i]].pb(B[i]);
G[B[i]].pb(A[i]);
}
dfs(0);
for(auto x:V) X[x]=V;
dfs1(0,-1);
ans+=(ll)v*(1LL<<id[p]);
for(auto i:X[p]) is[i]=1;
dfs2(p,-1);
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
Joi.cpp: In function 'void dfs1(int, int)':
Joi.cpp:59:17: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
59 | for(auto j:G1[i]) c+=is[j];if(c==1&&i!=o) l=i;
| ^~~
Joi.cpp:59:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
59 | for(auto j:G1[i]) c+=is[j];if(c==1&&i!=o) l=i;
| ^~
Joi.cpp: At global scope:
Joi.cpp:15:11: warning: 'infl' defined but not used [-Wunused-variable]
15 | static ll infl=1000000000000000007;
| ^~~~
Joi.cpp:14:12: warning: 'inf' defined but not used [-Wunused-variable]
14 | static int inf=1000000007;
| ^~~
Joi.cpp:13:11: warning: 'mod' defined but not used [-Wunused-variable]
13 | static ll mod=1000000007;
| ^~~
Ioi.cpp: In function 'void dfs1(int, int)':
Ioi.cpp:60:17: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
60 | for(auto j:G1[i]) c+=is[j];if(c==1&&i!=o) l=i;
| ^~~
Ioi.cpp:60:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
60 | for(auto j:G1[i]) c+=is[j];if(c==1&&i!=o) l=i;
| ^~
Ioi.cpp: At global scope:
Ioi.cpp:15:11: warning: 'infl' defined but not used [-Wunused-variable]
15 | static ll infl=1000000000000000007;
| ^~~~
Ioi.cpp:14:12: warning: 'inf' defined but not used [-Wunused-variable]
14 | static int inf=1000000007;
| ^~~
Ioi.cpp:13:11: warning: 'mod' defined but not used [-Wunused-variable]
13 | static ll mod=1000000007;
| ^~~
# | 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... |