# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
587687 | LastRonin | Flights (JOI22_flights) | C++17 | 9 ms | 1628 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 "Ali.h"
#include <string>
#include <vector>
#include <queue>
using namespace std;
vector<vector<int>> g;
int n;
void Init(int N, vector<int> U, vector<int> V) {
n = N;
g.clear();
for(int j = 0; j < n; j++) {
vector<int> a;
g.push_back(a);
}
for(int j = 0; j < U.size(); j++) {
int a = U[j], b = V[j];
g[a].push_back(b);
g[b].push_back(a);
}
for(int i = 0; i < n; i++)
SetID(i, i);
}
string SendA(string S) {
int v = 0;
for(int j = 0; j < S.size(); j++) {
if(S[j] == '1')
v += (1<<j);
}
int dist[n] = {0};
for(int i = 0; i < n; i++)
dist[i] = -1;
queue<int> q;
dist[v] = 0;
q.push(v);
while(q.size()) {
int a = q.front();
q.pop();
for(auto u : g[a]) {
if(dist[u] == -1) {
dist[u] = dist[a] + 1;
q.push(u);
}
}
}
string a;
for(int j = 0; j < n; j++) {
for(int i = 0; i < 20; i++) {
if((dist[j]>>i)&1)a += "1";
else a += "0";
}
}
return a;
}
#include "Benjamin.h"
#include <string>
#include <vector>
using namespace std;
namespace {
int n, x, y;
}
string SendB(int N, int X, int Y) {
x = X;
y = Y;
n = N;
string a;
for(int j = 0; j < 20; j++) {
if((1<<j)&x)a += "1";
else a += "0";
}
return a;
}
int Answer(string T) {
int pos = 0;
int answ = 0;
for(int j = 0, px = 0; j < n; j++, px += 20) {
int dist = 0,tek = 1;
for(int i = 0; i < 20; i++) {
if(px + i < T.size() && T[px + i] == '1')dist += tek;
tek *= 2;
}
if(j == y) {
answ = dist;
break;
}
}
return answ;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |