-
Notifications
You must be signed in to change notification settings - Fork 2
/
1.cpp
59 lines (54 loc) · 1.01 KB
/
1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <bits/stdc++.h>
#define endl '\n'
#define eat cin
#define moo cout
#define int long long
using namespace std;
string S1, S2, S3, S4;
int sum = 0;
vector<char> st[100];
void add(){
if(isdigit(S1[1])) return;
int idx = 1;
for(int i = 1; i < S1.size(); i += 4){
if(S1[i] != ' '){
st[idx].push_back(S1[i]);
}
idx++;
}
}
void solve(){
int a = stoi(S2);
int b = stoi(S3);
int c = stoi(S4);
for(int i = 0; i < a; i++){
st[c].push_back(st[b].back());
st[b].pop_back();
}
}
int32_t main(){
eat.tie(0) -> sync_with_stdio(0);
freopen("input.txt", "r", stdin);
while(getline(cin, S1)){
if(S1.length() == 0) break;
add();
}
for(int i = 0; i <100; i++){
reverse(st[i].begin(), st[i].end());
}
while(getline(cin, S1, ' ')){
getline(cin, S2, ' ');
getline(cin, S1, ' ');
getline(cin, S3, ' ');
getline(cin, S1, ' ');
getline(cin, S4);
solve();
}
for(int i = 0; i < 100; i++){
if(st[i].size() == 0) continue;
moo << st[i].back();
}
moo << endl;
// solve();
//moo << sum << endl;
}