Submission #567862

#TimeUsernameProblemLanguageResultExecution timeMemory
567862maomao90Flights (JOI22_flights)C++17
15 / 100
55 ms9528 KiB
#include "Ali.h" #include <bits/stdc++.h> using namespace std; #define REP(i, j, k) for (int i = j; i < k; i++) #define RREP(i, j, k) for (int i = j; i >= k; i--) template <class T> bool mnto(T &a, const T b) {return a > b ? a = b, 1 : 0;} template <class T> bool mxto(T &a, const T b) {return a < b ? a = b, 1 : 0;} typedef long long ll; #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; typedef tuple<int, int, int> iii; #define ALL(x) x.begin(), x.end() #define SZ(x) (int) x.size() #define pb push_back typedef vector<int> vi; typedef vector<ii> vii; typedef vector<ll> vll; #ifndef DEBUG #define cerr if(0) cerr #endif namespace { const int MAXN = 150005; const int INF = 1000000005; const ll LINF = 1000000000000000005; int n; vi adj[MAXN]; int rt; int pre[MAXN], pst[MAXN], mppre[MAXN], p[MAXN], ptr; void dfs(int u, int cp) { p[u] = cp; pre[u] = ptr++; mppre[pre[u]] = u; for (int v : adj[u]) { if (v == cp) continue; dfs(v, u); } pst[u] = ptr; } } void Init(int N, vi U, vi V) { n = N; REP (i, 0, n) { adj[i].clear(); } REP (i, 0, n - 1) { adj[U[i]].pb(V[i]); adj[V[i]].pb(U[i]); } ptr = 0; REP (i, 0, n) { if (adj[i].size() == 1) { rt = i; dfs(i, -1); break; } } REP (i, 0, n) { SetID(i, pre[i]); } } string SendA(string S) { string res = ""; REP (i, 1, n) { int u = mppre[i - 1], v = mppre[i]; while (pst[u] <= pre[v]) { u = p[u]; res += '0'; } res += '1'; } return res; }
#include "Benjamin.h" #include <bits/stdc++.h> using namespace std; #define REP(i, j, k) for (int i = j; i < k; i++) #define RREP(i, j, k) for (int i = j; i >= k; i--) template <class T> bool mnto(T &a, const T b) {return a > b ? a = b, 1 : 0;} template <class T> bool mxto(T &a, const T b) {return a < b ? a = b, 1 : 0;} typedef long long ll; #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; typedef tuple<int, int, int> iii; #define ALL(x) x.begin(), x.end() #define SZ(x) (int) x.size() #define pb push_back typedef vector<int> vi; typedef vector<ii> vii; typedef vector<ll> vll; #ifndef DEBUG #define cerr if(0) cerr #endif namespace { const int MAXN = 150005; const int INF = 1000000005; const ll LINF = 1000000000000000005; int n, x, y; vi adj[MAXN]; int p[MAXN], ptr; int dis[MAXN]; void dfs(int u, int p) { for (int v : adj[u]) { if (v == p) continue; dis[v] = dis[u] + 1; dfs(v, u); } } } string SendB(int N, int X, int Y) { n = N; x = X; y = Y; string s(20, '0'); return s; } int Answer(string T) { REP (i, 0, n) { adj[i].clear(); dis[i] = 0; } int u = 0; int ptr = 1; for (char c : T) { if (c == '1') { p[ptr] = u; adj[u].pb(ptr); adj[ptr].pb(u); u = ptr++; } else { u = p[u]; } } dfs(x, -1); return dis[y]; }

Compilation message (stderr)

grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~

Benjamin.cpp:36:15: warning: '{anonymous}::ptr' defined but not used [-Wunused-variable]
   36 |  int p[MAXN], ptr;
      |               ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...