Submission #733763

#TimeUsernameProblemLanguageResultExecution timeMemory
733763myrcellaFlights (JOI22_flights)C++17
30 / 100
616 ms1488 KiB
//by szh #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pii pair<int,int> #define pll pair<long long,long long> #define pb push_back #define debug(x) cerr<<#x<<"="<<x<<endl #define pq priority_queue #define inf 0x3f #define rep(i,a,b) for (int i=a;i<(b);i++) #define MP make_pair #define SZ(x) (int(x.size())) #define ll long long #define mod 1000000007 #define ALL(x) x.begin(),x.end() void inc(int &a,int b) {a=(a+b)%mod;} void dec(int &a,int b) {a=(a-b+mod)%mod;} int lowbit(int x) {return x&(-x);} ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;} const int sz = 1024; #include "Ali.h" const int maxn = 10010; int n; vector <int> edge[maxn]; int dis[maxn]; pq <pii,vector<pii>,greater<pii>> q; void Init(int N, std::vector<int> U, std::vector<int> V) { n = N; rep(i,0,N) { SetID(i,i); while (!edge[i].empty()) edge[i].pop_back(); } rep(i,0,N-1) edge[U[i]].pb(V[i]),edge[V[i]].pb(U[i]); } void dijkstra(int u) { memset(dis,inf,sizeof(dis)); dis[u] = 0; q.push({0,u}); while (!q.empty()) { int u = q.top().se, d = q.top().fi; q.pop(); if (dis[u]!=d) continue; for (int v:edge[u]) if (dis[v] > d+1) dis[v] = d+1, q.push({d+1,v}); } return; } std::string SendA(std::string S) { int x=0,y=0; rep(i,0,10) if (S[9-i]=='1') x += (1<<i); rep(i,0,10) if (S[19-i]=='1') y += (1<<i); string ret = ""; for (int u = x;u<n;u+=sz) { dijkstra(u); for (int v=y;v<n;v+=sz) { if (u>v) continue; string tmp = ""; rep(i,0,14) { if ((dis[v]>>i)&1) tmp += '1'; else tmp += '0'; } reverse(ALL(tmp)); ret += tmp; } } return ret; }
//by szh #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pii pair<int,int> #define pll pair<long long,long long> #define pb push_back #define debug(x) cerr<<#x<<"="<<x<<endl #define pq priority_queue #define inf 0x3f #define rep(i,a,b) for (int i=a;i<(b);i++) #define MP make_pair #define SZ(x) (int(x.size())) #define ll long long #define mod 1000000007 #define ALL(x) x.begin(),x.end() void inc(int &a,int b) {a=(a+b)%mod;} void dec(int &a,int b) {a=(a-b+mod)%mod;} int lowbit(int x) {return x&(-x);} ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;} const int sz = 1024; #include "Benjamin.h" int nn; int st,ed; std::string SendB(int N, int X, int Y) { if (X>Y) swap(X,Y); string tmp = ""; st = X, ed = Y; nn = N; X %= sz, Y %= sz; for (int i=9;i>=0;i--) if ((X>>i)&1) tmp += '1';else tmp+='0'; for (int i=9;i>=0;i--) if ((Y>>i)&1) tmp += '1';else tmp+='0'; return tmp; } int Answer(std::string T) { int cnt = 0; int u = st%sz, v = ed%sz; while (u!=st or v!=ed) { if (u<=v) cnt++; if (v+sz>=nn) u += sz, v = ed%sz; else v += sz; } int ret = 0; rep(i,0,14) if (T[cnt*14+13-i]=='1') ret += (1<<i); return ret; }

Compilation message (stderr)

grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...