# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080474 | veehj | City (JOI17_city) | C++17 | 1 ms | 796 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()
#include "Encoder.h"
vector<vector<ll>> adj;
vector<bool> vist;
set<ll> s;
void go(int nw){
ll c=nw;
for(auto& u : s){
c*=11;
c+=u;
}
s.insert(nw);
Code(nw-1, c);
for(auto& u : adj[nw]){
if(vist[u]) continue;
go(u);
}
s.erase(nw);
}
void Encode(int N, int A[], int B[]){
N++;
adj.assign(N, vector<ll>(0));
vist.assign(N, 0);
for(int i=0; i<N-2; i++){
adj[A[i]+1].pb(B[i]+1);
adj[B[i]+1].pb(A[i]+1);
}
go(1);
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()
#include "Device.h"
void InitDevice(){
}
int Answer(long long s, long long t){
set<int> a={}, b={};
int A, B;
while(s){
if(s<11){
A=s;
break;
}
a.insert(s%11);
s/=10;
}
while(t){
if(t<11){
B=t;
break;
}
b.insert(t%11);
t/=10;
}
if(a.count(B)) return 0;
if(b.count(A)) return 1;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |