Submission #139727

#TimeUsernameProblemLanguageResultExecution timeMemory
139727win11905Amusement Park (JOI17_amusement_park)C++14
28 / 100
37 ms4600 KiB
#include <bits/stdc++.h> #include "Joi.h" #define long long long using namespace std; const int N = 1e4+5; static int n, m; static long val; static vector<int> g[N]; static bool check[N]; static int ptr; static void dfs(int u) { MessageBoard(u, val >> (ptr++) & 1); ptr %= 60; check[u] = true; for(int v : g[u]) if(!check[v]) dfs(v); } void Joi(int N, int M, int A[], int B[], long X, int T) { n = N, m = M, val = X; for(int i = 0; i < m; ++i) { g[A[i]].emplace_back(B[i]); g[B[i]].emplace_back(A[i]); } dfs(0); }
#include <bits/stdc++.h> #include "Ioi.h" #define long long long using namespace std; const int N = 1e4+5; static int n, m; static vector<int> g[N]; static bool check[N]; static int ptr, pos[N]; static vector<int> euler; static void dfs(int u) { pos[u] = ptr++; ptr %= 60; check[u] = true; euler.emplace_back(u); for(int v : g[u]) if(!check[v]) { dfs(v); euler.emplace_back(u); } } static int cnt; static long val; static bool mark[60]; long Ioi(int N, int M, int A[], int B[], int P, int V, int T) { n = N, m = M; for(int i = 0; i < m; ++i) { g[A[i]].emplace_back(B[i]); g[B[i]].emplace_back(A[i]); } dfs(0); int z = euler.size(); reverse(euler.begin(), euler.end()); for(int i = 1; i < z; ++i) euler.emplace_back(euler[i]); ptr = -1; while(cnt < 60) { ptr++; if(cnt == 0 && euler[ptr] != P) continue; if(cnt != 0) V = Move(euler[ptr]); if(!mark[pos[euler[ptr]]]) mark[pos[euler[ptr]]] = true, cnt++; if(V) val |= 1ll << pos[euler[ptr]]; } return val; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...