Submission #49375

#TimeUsernameProblemLanguageResultExecution timeMemory
49375fallingstarAmusement Park (JOI17_amusement_park)C++17
10 / 100
40 ms5792 KiB
#include "Joi.h" #include <vector> using namespace std; #define long long long static const int N = 1e4 + 2; int GetBit(long x, int idx) { return (x >> idx) & 1; } static vector<int> g[N]; static bool vst[N]; static int tme = 0; static long mess; static void Dfs(int u) { vst[u] = true; MessageBoard(u, GetBit(mess, tme++ % 60)); for (int v: g[u]) if (!vst[v]) Dfs(v); } void Joi(int n, int m, int A[], int B[], long _mess, int subtask) { mess = _mess; for (int i = 0; i < m; ++i) { g[A[i]].push_back(B[i]); g[B[i]].push_back(A[i]); } Dfs(0); }
#include "Ioi.h" #include <iostream> #include <algorithm> #include <vector> #define long long long using namespace std; static const int N = 1e4 + 2; static vector<int> g[N]; static bool vst[N]; static int tme = 0, id[N]; static vector<int> a; static void Dfs(int u) { vst[u] = true; id[u] = tme++ % 60; for (int v: g[u]) if (!vst[v]) { a.push_back(v); Dfs(v); a.push_back(u); } } long Ioi(int n, int m, int A[], int B[], int start, int num, int subtask) { for (int i = 0; i < m; ++i) { g[A[i]].push_back(B[i]); g[B[i]].push_back(A[i]); } Dfs(0); a.insert(a.end(), a.begin(), a.end()); long x = 0; x |= (long) num << id[start]; auto it = ++find(a.begin(), a.end(), start); for (int moves = 0; moves < 120 && it != a.end(); ++moves) { x |= (long) Move(*it) << id[*it]; ++it; } return x; }
#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...