00100 6 4
00000 4 99999
00100 1 12309
68237 6 -1
33218 3 00000
99999 5 68237
12309 2 33218

00000 4 33218
33218 3 12309
12309 2 00100
00100 1 99999
99999 5 68237
68237 6 -1

# 分析

pair<int, string> a;


pair<string, string> a("James", "Joy");


typedef pair<string, string> author;
author pro("May", "Lily");
author joye("James", "Joyce");


1.对于pair类，由于它只有两个元素，分别名为first和second，因此直接使用普通的点操作符即可访问其成员

typedef pair<string, string> author;
author pro;
pro.first = "Lily";
pro.second = "Poly";


pair<string, string> author("Lily", "Poly");


2.生成新的pair对象

int a = 8;
string m = "James";
pair<int, string> newone;
newone = make_pair(a, m);


# 源代码

//C/C++实现
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef pair<int, int> P;

struct node{
};

int main(){
int start, n, k, address, data, next;
scanf("%d %d %d", &start, &n, &k);
vector<node> list;
for(int i = 0; i < n; ++i){
scanf("%d %d %d", &address, &data, &next);
P p;
p.first = data;
p.second = next;
}
int tmp = start;
while(tmp != -1){
node n;
list.push_back(n);
tmp = n.next;
}
for(int l = 0, index = 0; l < list.size() / k; ++l){
reverse(list.begin() + index, list.begin() + index + k);
index += k;
}
int o = 0;
for(; o < list.size() - 1; ++o){