Submission #923113

# Submission time Handle Problem Language Result Execution time Memory
923113 2024-02-06T16:46:43 Z winter0101 Amusement Park (JOI17_amusement_park) C++14
10 / 100
19 ms 6712 KB
#include<bits/stdc++.h>
#include "Joi.h"
using namespace std;
#define all(fl) fl.begin(),fl.end()
#define pb push_back
#define fi first
#define se second
#define for1(i,j,k) for(int i=j;i<=k;i++)
#define for2(i,j,k) for(int i=j;i>=k;i--)
#define for3(i,j,k,l) for(int i=j;i<=k;i+=l)
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()
#define pii pair<int,int>
#define pli pair<long long,int>
#define gcd __gcd
#define lcm(x,y) x*y/__gcd(x,y)
const int maxn=1e4+9;
vector<int>a[maxn];
vector<int>g[maxn];
int in[maxn],tme=0,par[maxn],out[maxn];
bool vis[maxn];
void dfs(int u){
vis[u]=1;
in[u]=++tme;
for (auto v:a[u]){
if (!vis[v]){
par[v]=u;
g[u].pb(v);
g[v].pb(u);
dfs(v);
}
}
out[u]=tme;
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
for1(i,0,M-1){
a[A[i]].pb(B[i]);
a[B[i]].pb(A[i]);
}
for1(i,0,N-1)sort(all(a[i]));
dfs(0);
for1(i,0,N-1){
long long bit=(in[i]-1)%60;
MessageBoard(i,(X>>bit&1ll));
}
}
#include<bits/stdc++.h>
#include "Ioi.h"
using namespace std;
#define all(fl) fl.begin(),fl.end()
#define pb push_back
#define fi first
#define se second
#define for1(i,j,k) for(int i=j;i<=k;i++)
#define for2(i,j,k) for(int i=j;i>=k;i--)
#define for3(i,j,k,l) for(int i=j;i<=k;i+=l)
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()
#define pii pair<int,int>
#define pli pair<long long,int>
#define gcd __gcd
#define lcm(x,y) x*y/__gcd(x,y)
const int maxn=1e4+9;
vector<int>a[maxn];
vector<int>g[maxn];
int in[maxn],tme=0,par[maxn],out[maxn];
bool vis[maxn];
void dfs(int u){
vis[u]=1;
in[u]=++tme;
for (auto v:a[u]){
if (!vis[v]){
par[v]=u;
g[u].pb(v);
g[v].pb(u);
dfs(v);
}
}
out[u]=tme;
}
int dem=0;
bool bit[maxn];
bool revis[maxn];
vector<int>rg[maxn];
void redfs(int u){
dem++;
revis[u]=1;
if (dem==60)return;
for (auto v:g[u]){
if (dem==60)return;
if (!revis[v]){
rg[u].pb(v);
rg[v].pb(u);
//cerr<<u<<" "<<v<<'\n';
redfs(v);
if (dem==60)return;
}
}
}
void solve(int u){
revis[u]=1;
for (auto v:rg[u]){
if (!revis[v]){
bit[v]=Move(v);
solve(v);
bit[u]=Move(u);
}
}
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
for1(i,0,N-1){
a[i].clear(),g[i].clear();
vis[i]=0;
}
for1(i,0,M-1){
a[A[i]].pb(B[i]);
a[B[i]].pb(A[i]);
}
for1(i,0,N-1)sort(all(a[i]));
tme=0;
dfs(0);
for1(i,0,N-1)revis[i]=0;
redfs(P);
for1(i,0,N-1)revis[i]=0;
solve(P);
long long ans=0;
for1(i,0,N-1){
if (revis[i]){
long long bb=(in[i]-1)%60;
if (bit[i])ans+=(1ll<<bb);
}
}
return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2064 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 5984 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2060 KB Output is correct
2 Correct 1 ms 2068 KB Output is correct
3 Correct 2 ms 2080 KB Output is correct
4 Correct 2 ms 2768 KB Output is correct
5 Correct 3 ms 2628 KB Output is correct
6 Correct 2 ms 2632 KB Output is correct
7 Correct 2 ms 2620 KB Output is correct
8 Correct 2 ms 2628 KB Output is correct
9 Correct 11 ms 6464 KB Output is correct
10 Correct 10 ms 6196 KB Output is correct
11 Correct 11 ms 6712 KB Output is correct
12 Correct 2 ms 2068 KB Output is correct
13 Correct 2 ms 2064 KB Output is correct
14 Correct 1 ms 2068 KB Output is correct
15 Correct 2 ms 2068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 5988 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 5980 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -