Submission #934056

#TimeUsernameProblemLanguageResultExecution timeMemory
934056sopaconkCity (JOI17_city)C++17
18 / 100
329 ms44984 KiB
#include "Encoder.h" #include<bits/stdc++.h> using namespace std; #define pb push_back #define deb(x) ; using lli=long long int; static lli aux=0; void dfs(int n , int par, vector<vector<int>> &adj, vector<pair<lli,lli>> &range ){ lli ini=aux; aux++; for(int x: adj[n]){ if(x==par) continue; dfs(x, n, adj, range); } lli fin=aux; aux++; range[n]={ini, fin}; } void Encode(int N, int A[], int B[]) { vector<vector<int>> adj (N); for(int i=0; i<N-1; ++i){ adj[A[i]].pb(B[i]); adj[B[i]].pb(A[i]); } vector<pair<lli,lli>> range (N); dfs(0,-1,adj, range); for (int i = 0; i < N; ++i) { Code(i, range[i].first*500000+range[i].second); } }
#include "Device.h" #include<bits/stdc++.h> using namespace std; #define pb push_back #define deb(x) ; using lli=long long int; void InitDevice() { } int Answer(long long S, long long T) { lli finS=S%500000; lli iniS= (S-finS)/500000; lli finT=T%500000; lli iniT=(T-finT)/500000; if(iniT <= iniS && finS <= finT){ return 0; } if(iniS <= iniT && finT <= finS){ return 1; } return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...