Submission #711042

#TimeUsernameProblemLanguageResultExecution timeMemory
711042minhcoolFlights (JOI22_flights)C++17
21 / 100
354 ms9836 KiB
#include "Ali.h" #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int N = 3e5 + 5; const int mod = 1e9 + 7, oo = 1e18 + 7; vector<int> Adj[N]; int d[N], anc[N][20]; void dfs(int u, int p){ for(auto v : Adj[u]){ if(v == p) continue; d[v] = d[u] + 1; anc[v][0] = u; for(int i = 1; i <= 19; i++) anc[v][i] = anc[anc[v][i - 1]][i - 1]; dfs(v, u); } } int lca(int x, int y){ if(d[x] > d[y]) swap(x, y); for(int i = 19; i >= 0; i--){ if(d[y] >= (d[x] + (1LL << i))) y = anc[y][i]; } if(x == y) return x; for(int i = 19; i >= 0; i--){ if(anc[x][i] != anc[y][i]){ x = anc[x][i], y = anc[y][i]; } } return anc[x][0]; } int n; int dist(int x, int y){ if(x > n || y > n) return 0; return d[x] + d[y] - 2 * d[lca(x, y)]; } void Init(int N, vector<int> U, vector<int> V) { /* variable_example++; SetID(0, 0); SetID(1, 1); SetID(2, 2 * N + 19);*/ n = N; for(int i = 0; i < n; i++) Adj[i].clear(); for(int i = 0; i < (n - 1); i++){ Adj[U[i]].pb(V[i]); Adj[V[i]].pb(U[i]); } dfs(0, 0); //cout << dist(5883, 4764) << "\n"; for(int i = 0; i < n; i++) SetID(i, i); } string SendA(string S) { int temp0 = 0, temp1 = 0; for(int i = 0; i < 10; i++) if(S[i] == '1') temp0 |= (1LL << i); for(int i = 0; i < 10; i++) if(S[i + 10] == '1') temp1 |= (1LL << i); temp0 *= 10, temp1 *= 10; string ans = ""; for(int i = 0; i < 10; i++){ for(int j = 0; j < 10; j++){ int temp = dist(temp0 + i, temp1 + j); //cout << temp0 + i << " " << temp1 + j << " " << temp << "\n"; for(int k = 0; k < 14; k++){ if(temp & (1LL << k)) ans += "1"; else ans += "0"; } } } return ans; }
#include "Benjamin.h" #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int N = 3e5 + 5; const int mod = 1e9 + 7, oo = 1e18 + 7; int x, y; string SendB(int N, int X, int Y) { x = X, y = Y; int temp0 = X / 10, temp1 = Y / 10; string s; for(int i = 0; i < 10; i++){ if(!(temp0 & (1LL << i))) s += "0"; else s += "1"; } for(int i = 0; i < 10; i++){ if(!(temp1 & (1LL << i))) s += "0"; else s += "1"; } return s; } int Answer(string T) { int tol = ((x % 10) * 10) + (y % 10), ans = 0; for(int i = tol * 14; i < (tol + 1) * 14; i++){ if(T[i] == '1') ans += (1LL << (i - tol * 14)); } return ans; }

Compilation message (stderr)

Ali.cpp:14:36: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   14 | const int mod = 1e9 + 7, oo = 1e18 + 7;
      |                               ~~~~~^~~
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~

Benjamin.cpp:14:36: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   14 | const int mod = 1e9 + 7, oo = 1e18 + 7;
      |                               ~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...