# PAT basic-level 1075 連結串列元素分類 筆記

## 1075. 連結串列元素分類(25)

400 ms

65536 kB

8000 B

Standard

CHEN, Yue

00100 9 10
23333 10 27777
00000 0 99999
00100 18 12309
68237 -6 23333
33218 -4 00000
48652 -2 -1
99999 5 68237
27777 11 48652
12309 7 33218

33218 -4 68237
68237 -6 48652
48652 -2 12309
12309 7 00000
00000 0 99999
99999 5 23333
23333 10 00100
00100 18 27777
27777 11 -1

``````#include <iostream>
#include <vector>
using namespace std;
struct node{
int data;
int next;
};
struct sode{
int data;
int next;
};
int main(){
cin >> firadd >> n >> k;
vector<node> p(100000);
for (int i = 0; i < n; i  ){
}
vector< vector<sode> > ep(3);
sode t;
ep[0].push_back(t);
ep[1].push_back(t);
} else {
ep[2].push_back(t);
}
}
for(int j = 0; j < 3;   j){
if (ep[j].size() == 0)
continue;
int i = 0;
for (; i < ((int)ep[j].size() - 1);   i)
if (j < 2 && ep[j   1].size() != 0)
else if (j == 0 && ep[j   2].size() != 0)
else ep[j][i].next = -1;
}
for (int i = 0; i < 3; i  ){
for (int j = 0; j < ep[i].size();   j){
if (ep[i][j].next != -1)
printf("%05d %d %05d\n", ep[i][j].add, ep[i][j].data, ep[i][j].next);
else {