Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- #include<string>
- using namespace std;
- void copy_pb(vector <vector<string>>& tmp, int& first, int& second) {
- }
- int main() {
- vector <int> month = { 31,28,31,30,31,30,31,30,31,30,30,31 };
- int mi = 0;
- vector<vector<string>> tmp(month[mi]);
- int n;
- cin >> n;
- for (int i = 0; i < n; ++i) {
- string sel;
- cin >> sel;
- if (sel == "ADD") {
- string work;
- int day;
- cin >> day >> work;
- tmp[day - 1].push_back(work);
- }
- else if (sel == "DUMP") {
- int day;
- cin >> day;
- for (const auto& s : tmp[day - 1]) {
- cout << s << ' ';
- }
- }
- else if (sel == "NEXT") {
- if (mi == 11) {
- mi = 0;
- }
- else if(month[mi+1]<month[mi]){
- ++mi;
- int diff = month[mi-1] - month[mi];
- vector <vector<string>> reverse(month[mi]);
- for (int i = 0; i<diff; ++i) {
- reverse[i] = tmp[tmp.size() - i - 1];
- }
- tmp.resize(month[mi]);
- tmp.insert(end(tmp), begin(reverse), end(reverse));
- }
- else if (month[mi] > month[mi - 1]) {
- tmp.resize(month[mi]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement