# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934108 | Juanchoki | City (JOI17_city) | C++14 | 314 ms | 65160 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |