Submission #934101

#TimeUsernameProblemLanguageResultExecution timeMemory
934101JuanchokiCity (JOI17_city)C++14
18 / 100
346 ms64928 KiB
#include "Encoder.h" #include <vector> #include <iostream> using namespace std; static const int maxn = 1<<20; static vector<int> adj[maxn]; static int ini[maxn], fin[maxn]; static int pos = 1; static void dfs(int yo, int pa) { ini[yo] = pos++; for (int v: adj[yo]) if (v != pa) dfs(v, yo); fin[yo] = pos-1; } void Encode(int N, int A[], int B[]) { //cout << "llama "; vector<int> v; for (int i = 0; i < N-1; ++i) { adj[A[i]].push_back(B[i]); adj[B[i]].push_back(A[i]); } dfs(0, -1); long long temp; for (int i = 0; i < N; i++) { //cout << i << " " << ini[i] << " " << fin[i] << '\n'; temp = ini[i]*(1e6) + fin[i]; //cout << temp << " "; Code(i, temp); } } // g++ grader.cpp Encoder.cpp Device.cpp
#include "Device.h" #include <vector> #include <string> #include <iostream> using namespace std; void InitDevice() { } int Answer(long long S, long long T) { int div = 1e6; //cout << S << " " << T << '\n'; long long iniS = S/div, iniT = T/div; long long finS = S%div, finT = T%div; //cout << iniS << " " << finS << '\n'; //cout << iniT << " " << finT << '\n'; if (iniS <= iniT && finT <= finS) { return 1; } if (iniT <= iniS && finS <= finT) { return 0; } return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...