# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934101 | Juanchoki | City (JOI17_city) | C++14 | 346 ms | 64928 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 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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |