1.Распечатать список

 avatar
user_5940704881
c_cpp
3 years ago
411 B
4
Indexable
Never
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios_base::sync_with_stdio(false);cin.tie(NULL)
int main(){
  FastRead;
  int t,in;
  cin>>t>>in;
  map<double,int>mp;
  vector<double>v;

  for(int i=0;i<t;i++){
    double a;
    int b;
    cin>>a>>b;
    v.push_back(a);
    mp[a]=b;
  }
  while(in!=(-1)){
    cout<<fixed<<setprecision(3)<<v[in]<<endl;
    in=mp[v[in]];
  }
}