제출 #1260724

#제출 시각아이디문제언어결과실행 시간메모리
1260724riddles세계 지도 (IOI25_worldmap)C++20
0 / 100
1117 ms2162688 KiB
#include "worldmap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef map<ll, ll> mp;
typedef pair<ll, ll> pll;
typedef queue<ll> qi;
typedef vector<ll> vi;
typedef vector <vi> vvi;
typedef vector <pll> vpl;
typedef vector <string> vs;
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define f first
#define s second
#define pb push_back
#define all(x) begin(x), end(x)

int n, m;
vector<int> a, b;
vector<vector<int>> ans;
vector<vector<int>> con;
vector<int> etour;

void dfs(int u, int p) {
    etour.pb(u);
    for (int i: con[u]) {
        if (i!=p) {
            dfs(i, u);
            etour.pb(u);
        }
    }
}

vector<vector<int>> create_map(int N, int M, vector<int> A, vector<int> B) {
  n=N;
  m=M;
  a=A;
  b=B;
  con=vector<vector<int>> (n);

  for(ll i=0; i<m; i++){
    a[i]--, b[i]--;
    con[a[i]].pb(b[i]);
    con[b[i]].pb(a[i]);
  }

  dfs(0, -1);

  int k=etour.size();
  ans=vector<vector<int>> (k, vector<int>(k, 1));
  for(ll i=0; i<k; i++) for(ll j=0; j<k; j++) ans[i][j]=etour[j]+1;
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...