제출 #934108

#제출 시각아이디문제언어결과실행 시간메모리
934108JuanchokiCity (JOI17_city)C++14
18 / 100
314 ms65160 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 int tam[maxn]; static int dfs(int yo, int pa) { ini[yo] = pos++; int cnt = 1; for (int v: adj[yo]) if (v != pa) cnt+=dfs(v, yo); fin[yo] = pos-1; return tam[yo] = cnt; } 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) + tam[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 = iniS + S%div, finT = iniT + 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...