Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <iostream>
- #include <string>
- using namespace std;
- void dump(const vector<string>& days,const vector<int>& count, int& x){
- cout << count[x-1] << " ";
- cout << days[x-1] << endl;
- }
- void add(vector<string>& days,vector<int>& count, int& x, string& s){
- days[x-1]+=s+" ";
- count[x-1]++;
- }
- void next(vector<string>& days,vector<int>& count,int& k){
- if(k%12==0){
- for(int i=28;i<31;i++){
- days[27]+=days[i]+"";
- count[27]+=count[i];
- days[i]="";
- count[i]=0;
- }
- days.resize(28);
- } else if(days.size()<31){
- days[29]+=days[30]+"";
- count[29]+=count[30];
- days[30]="";
- count[30]=0;
- } else days.resize(31);
- k++;
- }
- int main(){
- int q,k,x;
- string s,c;
- vector<string> days(31);
- vector<int> count(31);
- k=12;
- cin >> q;
- for(int j=0; j<q;j++){
- cin >> c;
- if(c=="NEXT"){
- next(days,count,k);
- } else{
- cin >> x;
- if(c=="DUMP"){
- dump(days,count,x);
- } else if(c=="ADD"){
- cin >> s;
- add(days,count,x,s);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement