# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95678 | tqbfjotld | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 7 ms | 460 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 "messy.h"
#include <vector>
#include <string>
using namespace std;
bool visited[129];
vector<int> adjl[129];
int c = 0;
int ans[129];
void dfs(int node){
ans[node] = c;
c++;
visited[node]=true;
for (int x = 0; x<adjl[node].size(); x++){
if (!visited[adjl[node][x]]){
dfs(adjl[node][x]);
}
}
}
std::vector<int> restore_permutation(int n, int w, int r) {
vector<string> original;
for (int x = 0; x<n-1; x++){
string s = "";
for(int y = 0; y<n; y++){
if (y==x||y==x+1){
s+="1";
}
else s+="0";
}
add_element(s);
}
string k = "1";
for (int x = 0; x<n-1; x++){
k+="0";
}
add_element(k);
compile_set();
for (int x = 0; x<n; x++){
for (int y = x+1; y<n; y++){
k = "";
for (int z = 0; z<n; z++){
if (z==x||z==y) k+="1";
else k+="0";
}
if (check_element(k)){
adjl[x].push_back(y);
adjl[y].push_back(x);
}
}
}
int start;
for (int x = 0; x<n; x++){
k = "";
for (int z = 0; z<n; z++){
if (z==x) k+="1";
else k+="0";
}
if (check_element(k)){
start = x;
}
}
dfs(start);
vector<int> vans;
for (int x = 0; x<n; x++){
vans.push_back(ans[x]);
}
return vans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |