# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
934024 | Maaxle | City (JOI17_city) | C++17 | 383 ms | 67584 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Encoder.h"
#include <bits/stdc++.h>
#define range(it, a, b) for (ll it = a; it < b; it++)
#define all(x) begin(x), end(x)
#define ll long long
#define ull unsigned long long
#define INF64 ((ll) 1 << 60)
#define INF32 (1 << 30)
#define mset multiset
#define uset unordered_set
#define umap unordered_map
#define pqueue priority_queue
#define ptr(A) shared_ptr<A>
using namespace std;
ll n;
vector<vector<ll>> adj, range;
vector<ll> euler;
void explore(ll i, ll from) {
range[i][0] = euler.size();
euler.push_back(i);
for (ll k : adj[i]) {
if (k == from)
continue;
explore(k, i);
}
range[i][1] = euler.size();
euler.push_back(i);
string l = to_string(range[i][0]);
string r = to_string(range[i][1]);
while (r.size() < 6)
r = "0"+r;
Code(i, stoll(l + r));
}
void Encode(int N, int A[], int B[]) {
n = N;
adj.resize(n);
range.resize(n, vector<ll> (2));
range(i, 0, n - 1) {
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
explore(0, 0);
}
#include "Device.h"
#include <bits/stdc++.h>
#define range(it, a, b) for (ll it = a; it < b; it++)
#define all(x) begin(x), end(x)
#define ll long long
#define ull unsigned long long
#define INF64 ((ll) 1 << 60)
#define INF32 (1 << 30)
#define mset multiset
#define uset unordered_set
#define umap unordered_map
#define pqueue priority_queue
#define ptr(A) shared_ptr<A>
using namespace std;
void InitDevice() { }
int Answer(long long S, long long T) {
string ss = to_string(S);
while (ss.size() < 7)
ss = "0" + ss;
string ts = to_string(T);
while (ts.size() < 7)
ts = "0" + ts;
ll ind = ss.size() - 6;
ll sl = stoll(ss.substr(0, ind));
ll sr = stoll(ss.substr(ind, 6));
ind = ts.size() - 6;
ll tl = stoll(ts.substr(0, ind));
ll tr = stoll(ts.substr(ind, 6));
// cout << sl << ' ' << sr << '\n';
// cout << tl << ' ' << tr << '\n';
ll ans;
if (sl < tl && tr < sr)
ans = 1;
else if (tl < sl && sr < tr)
ans = 0;
else
ans = 2;
// cout << ans << '\n';
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |