Submission #933694

# Submission time Handle Problem Language Result Execution time Memory
933694 2024-02-26T06:20:21 Z parlimoos Amusement Park (JOI17_amusement_park) C++14
0 / 100
19 ms 5916 KB
//‌Be Name KHODA
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include "Joi.h"
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define pp pop_back
#define lb lower_bound
#define ub upper_bound
#define cl clear
#define bg begin
#define arr(x) array<int , x>
#define endl '\n'

vector<int> jg[10000] , jtr[10000];
int jh[10000] , jtms[10000] , cjh[10000];
bool jms[10000];

int jtimer = -1;
void jdfs1(int v = 0 , int p = -1){
    jh[v] = 1 , jms[v] = 1;
    if(p != -1) cjh[v] = cjh[p] + 1;
    for(int u : jg[v]){
        if(jms[u]) continue;
        jtr[v].pb(u);
        jdfs1(u) , jh[v] = max(jh[v] , jh[u] + 1);
    }
}
void jdfs2(int v = 0){
    jtms[v] = ++jtimer;
    int mxi = -1;
    for(int u : jtr[v]) if(mxi == -1 or jh[mxi] < jh[u]) mxi = u;
    if(mxi == -1) return;
    jdfs2(mxi);
    for(int u : jtr[v]) if(u != mxi) jdfs2(u);
}
void Joi(int N , int M , int A[] , int B[] , ll X , int T){
    for(int i = 0 ; i < M ; i++) jg[A[i]].pb(B[i]) , jg[B[i]].pb(A[i]);
    jdfs1() , jdfs2();
    if(jh[0] >= 60){
        for(int i = 0 ; i < N ; i++) MessageBoard(i , (X >> (cjh[i] % 60)) & 1);
    }else for(int i = 0 ; i < N ; i++) MessageBoard(i , (X >> (jtms[i] % 60)) & 1);
}
//Be Name KHODA
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include "Ioi.h"
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define pp pop_back
#define lb lower_bound
#define ub upper_bound
#define cl clear
#define bg begin
#define arr(x) array<int , x>
#define endl '\n'

int n;
vector<int> g[10000] , tr[10000];
int h[10000] , tms[10000] , ps[10000];
int ch[10000] , mxi[10000];
bool ms[10000];
ll o = 0;

int timer = -1;
void dfs1(int v = 0 , int p = -1){
    ms[v] = 1 , h[v] = 1 , ps[v] = p;
    if(p != -1) ch[v] = ch[p] + 1;
    for(int u : g[v]){
        if(ms[u]) continue;
        tr[v].pb(u);
        dfs1(u , v) , h[v] = max(h[v] , h[u] + 1);
    }
}
void dfs2(int v = 0){
    tms[v] = ++timer , mxi[v] = -1;
    for(int u : tr[v]) if(mxi[v] == -1 or h[mxi[v]] < h[u]) mxi[v] = u;
    if(mxi[v] == -1) return;
    dfs2(mxi[v]);
    for(int u : tr[v]) if(mxi[v] != u) dfs2(u);
}
void dfs3(int v , bool bb){
    for(int u : tr[v]){
        if(bb){
            if(u != mxi[v] and tms[u] < 60){
                ll d = Move(u);
                o |= (d << tms[u]);
                dfs3(u , 0);
                d = Move(v);
            }
        }else{
            if(tms[u] < 60){
                ll d = Move(u);
                o |= (d << tms[u]);
                dfs3(u , 0);
                d = Move(v);
            }
        }
    }
}
ll Ioi(int N , int M , int A[] , int B[] , int P , int V , int T){
    n = N;
    for(int i = 0 ; i < M ; i++) g[A[i]].pb(B[i]) , g[B[i]].pb(A[i]);
    dfs1() , dfs2();
    if(h[0] >= 60){
        if(ch[P] < 60){
            ll d;
            while(P != 0) d = Move(ps[P]) , P =  ps[P];
            o |= d;
            for(int i = 1 ; i < 60 ; i++){
                d = Move(mxi[P]) , P = mxi[P];
                o |= (d << i);
            }
        }else{
            o |= (V << (ch[P] % 60));
            ll d;
            for(int i = 1 ; i < 60 ; i++){
                d = Move(ps[P]) , P = ps[P];
                o |= (d << (ch[P] % 60));
            }
        }
        return o;
    }
    ll d;
    while(P != 0) d = Move(ps[P]) , P = ps[P];
    o = d;
    while(true){
        dfs3(P , 1);
        if(mxi[P] == -1) break;
        d = Move(mxi[P]) , P = mxi[P];
        o |= (d << tms[P]);
    }
    return o;
}

Compilation message

Ioi.cpp: In function 'll Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:86:7: warning: 'd' may be used uninitialized in this function [-Wmaybe-uninitialized]
   86 |     o = d;
      |     ~~^~~
Ioi.cpp:69:15: warning: 'd' may be used uninitialized in this function [-Wmaybe-uninitialized]
   69 |             o |= d;
      |             ~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1820 KB Output is correct
2 Correct 2 ms 1828 KB Output is correct
3 Correct 2 ms 1828 KB Output is correct
4 Incorrect 2 ms 1812 KB Wrong Answer [7]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 5732 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1824 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 5908 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 5916 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -