题目链接:1074. Reversing Linked List (25)
#include
const int maxn =100100;
using namespace std;
int n,k,sum,first,add,data[maxn],next1[maxn],list1[maxn],result[maxn];
int main(){
cin>>first>>n>>k;
for(int i=0;i>add;
cin>>data[add]>>next1[add];
}
while(first!=-1){
list1[sum++]=first;
first=next1[first];
}
for(int i=0;i