1
#include<bits/stdc++.h>
using namespace std;
class Date{
private:
int y_,m_,d_;
public:
Date(){}
Date(int a,int b,int c) {y_=a;m_=b;d_=c;}
void showDate(){
cout<<setw(4)<<setfill('0')<<y_<<"-"<<setw(2)<<setfill('0')<<m_<<"-" <<setw(2)<<setfill('0')<<d_;
}
};
class Time{
private:
int h_,m_,s_;
public:
Time(int h,int m,int s):h_(h),m_(m),s_(s) {}
void showTime(){
cout<<setw(2)<<setfill('0')<<h_<<":"<<setw(2)<<setfill('0')<<m_<<":"<<setw(2)<<setfill('0')<<s_;
}
};
2
#include<bits/stdc++.h>
using namespace std;
#include<bits/stdc++.h>
using namespace std;
class Date{
private:
int y_,m_,d_;
public:
Date():y_(1),m_(1),d_(1) {}
Date(const Date& id):y_(id.y_),m_(id.m_),d_(id.d_) {}
Date(int a,int b,int c) {y_=a;m_=b;d_=c;}
void showDate(){
cout<<setw(4)<<setfill('0')<<y_<<"-"<<setw(2)<<setfill('0')<<m_<<"-" <<setw(2)<<setfill('0')<<d_;
}
int yy() { return y_; }
int yy(int y1) { return y_=y1; }
int mm() { return m_; }
int mm(int m1) { return m_=m1; }
int dd() { return d_; }
int dd(int d1) { return d_=d1; }
Date &setDate(int y1,int m1,int d1){
y_=y1;
m_=m1;
d_=d1;
return *this;
}
};
class Time{
private:
int h_,m_,s_;
public:
Time(int h,int m,int s):h_(h),m_(m),s_(s) {}
void showTime(){
cout<<setw(2)<<setfill('0')<<h_<<":"<<setw(2)<<setfill('0')<<m_<<":"<<setw(2)<<setfill('0')<<s_;
}
Time():h_(0),m_(0),s_(0) {}
Time(const Time& id):h_(id.h_),m_(id.m_),s_(id.s_) {}
int hh() { return h_; }
int hh(int h1) { return h_=h1; }
int mm1() { return m_; }
int mm1(int m1) { return m_=m1; }
int ss() { return s_; }
int ss(int s1) { return s_=s1; }
Time &setTime(int h1,int m1,int s1){
h_=h1;
m_=m1;
s_=s1;
return *this;
}
};
class DateTime:public Date,public Time{
public:
DateTime():Date(),Time(){}
DateTime(const Date& inp,const Time& ind):Date(inp), Time(ind) {}
DateTime(int y,int m,int d,int h,int m1,int s):Date(y,m,d),Time(h,m1,s) {}
void showDateTime(){
printf("%d-%02d-%02d %02d:%02d:%02d",yy(),mm(),dd(),hh(),mm1(),ss());
}
DateTime &setDateTime(int y,int m,int d,int h,int m1,int s){
yy(y); mm(m); dd(d); hh(h); mm1(m1); ss(s);
return *this;
}
};
3
#include<bits/stdc++.h>
using namespace std;
#include<bits/stdc++.h>
using namespace std;
class Date{
private:
int y_,m_,d_;
public:
Date():y_(1),m_(1),d_(1) {printf("CREATE Date : (%d, %d, %d)\n",y_,m_,d_);}
Date(const Date& id):y_(id.y_),m_(id.m_),d_(id.d_) {}
Date(int a,int b,int c) {y_=a;m_=b;d_=c;printf("CREATE Date : (%d, %d, %d)\n",y_,m_,d_);}
void showDate(){
cout<<setw(4)<<setfill('0')<<y_<<"-"<<setw(2)<<setfill('0')<<m_<<"-" <<setw(2)<<setfill('0')<<d_;
}
int yy() { return y_; }
int yy(int y1) { return y_=y1; }
int mm() { return m_; }
int mm(int m1) { return m_=m1; }
int dd() { return d_; }
int dd(int d1) { return d_=d1; }
Date &setDate(int y1,int m1,int d1){
y_=y1;
m_=m1;
d_=d1;
return *this;
}
};
class Time{
private:
int h_,m_,s_;
public:
Time(int h,int m,int s):h_(h),m_(m),s_(s) {printf("CREATE Time : (%d, %d, %d)\n",h_,m_,s_);}
void showTime(){
cout<<setw(2)<<setfill('0')<<h_<<":"<<setw(2)<<setfill('0')<<m_<<":"<<setw(2)<<setfill('0')<<s_;
}
Time():h_(0),m_(0),s_(0) {printf("CREATE Time : (%d, %d, %d)\n",h_,m_,s_);}
Time(const Time& id):h_(id.h_),m_(id.m_),s_(id.s_) {}
int hh() { return h_; }
int hh(int h1) { return h_=h1; }
int mm1() { return m_; }
int mm1(int m1) { return m_=m1; }
int ss() { return s_; }
int ss(int s1) { return s_=s1; }
Time &setTime(int h1,int m1,int s1){
h_=h1;
m_=m1;
s_=s1;
return *this;
}
};
class DateTime:public Time,public Date{
public:
DateTime():Time(),Date() {printf("CREATE DateTime : (%d, %d, %d, %d, %d, %d)\n",yy(),mm(),dd(),hh(),mm1(),ss());}
DateTime(const Date& inp,const Time& ind):Date(inp), Time(ind) {}
DateTime(int y,int m,int d,int h,int m1,int s):Date(y,m,d),Time(h,m1,s) {printf("CREATE DateTime : (%d, %d, %d, %d, %d, %d)\n",yy(),mm(),dd(),hh(),mm1(),ss());}
void showDateTime(){
printf("%04d-%02d-%02d %02d:%02d:%02d",yy(),mm(),dd(),hh(),mm1(),ss());
}
DateTime &setDateTime(int y,int m,int d,int h,int m1,int s){
yy(y); mm(m); dd(d); hh(h); mm1(m1); ss(s);
return *this;
}
};
4
#include<bits/stdc++.h>
using namespace std;
#include<bits/stdc++.h>
using namespace std;
class Date{
private:
int y_,m_,d_;
public:
Date():y_(1),m_(1),d_(1) {printf("CREATE Date : (%d, %d, %d)\n",y_,m_,d_);}
Date(const Date& id):y_(id.y_),m_(id.m_),d_(id.d_) {printf("COPY Date : (%d, %d, %d)\n",y_, m_, d_);}
Date(int a,int b,int c) {y_=a;m_=b;d_=c;printf("CREATE Date : (%d, %d, %d)\n",y_,m_,d_);}
void showDate(){
cout<<setw(4)<<setfill('0')<<y_<<"-"<<setw(2)<<setfill('0')<<m_<<"-" <<setw(2)<<setfill('0')<<d_;
}
int yy() const { return y_; }
int yy(int y1) { return y_=y1; }
int mm()const { return m_; }
int mm(int m1) { return m_=m1; }
int dd() const{ return d_; }
int dd(int d1) { return d_=d1; }
Date &setDate(int y1,int m1,int d1){
y_=y1;
m_=m1;
d_=d1;
return *this;
}
Date& rd() { return *this; }
};
class Time{
private:
int h_,m_,s_;
public:
Time(int h,int m,int s):h_(h),m_(m),s_(s) {printf("CREATE Time : (%d, %d, %d)\n",h_,m_,s_);}
void showTime(){
cout<<setw(2)<<setfill('0')<<h_<<":"<<setw(2)<<setfill('0')<<m_<<":"<<setw(2)<<setfill('0')<<s_;
}
Time():h_(0),m_(0),s_(0) {printf("CREATE Time : (%d, %d, %d)\n",h_,m_,s_);}
Time(const Time& id):h_(id.h_),m_(id.m_),s_(id.s_) {printf("COPY Time : (%d, %d, %d)\n",h_, m_, s_);}
int hh()const { return h_; }
int hh(int h1) { return h_=h1; }
int mm1()const { return m_; }
int mm1(int m1) { return m_=m1; }
int ss() const{ return s_; }
int ss(int s1) { return s_=s1; }
Time &setTime(int h1,int m1,int s1){
h_=h1;
m_=m1;
s_=s1;
return *this;
}
Time& rt() { return *this; }
};
class DateTime:public Time,public Date{
public:
DateTime():Time(),Date() {printf("CREATE DateTime : (%d, %d, %d, %d, %d, %d)\n",yy(),mm(),dd(),hh(),mm1(),ss());}
DateTime(const Date& inp,const Time& ind):Date(inp), Time(ind) {printf("CREATE DateTime : (%d, %d, %d, %d, %d, %d)\n",yy(),mm(),dd(),hh(),mm1(),ss());}
DateTime(int y,int m,int d,int h,int m1,int s):Date(y,m,d),Time(h,m1,s) {printf("CREATE DateTime : (%d, %d, %d, %d, %d, %d)\n",yy(),mm(),dd(),hh(),mm1(),ss());}
DateTime(DateTime& id):Date(id.rd()),Time(id.rt()){ printf("COPY DateTime : (%d, %d, %d) (%d, %d, %d)\n",yy(),mm(),dd(),hh(),mm1(),ss()); }
void showDateTime(){
printf("%04d-%02d-%02d %02d:%02d:%02d",yy(),mm(),dd(),hh(),mm1(),ss());
}
DateTime &setDateTime(int y,int m,int d,int h,int m1,int s){
yy(y); mm(m); dd(d); hh(h); mm1(m1); ss(s);
return *this;
}
int hour() const { return hh(); }
int minute() const { return mm1(); }
int second() const { return ss(); }
int hour(int h1){return hh(h1);}
int minute(int m1){return mm1(m1);}
int second(int s1){return ss(s1);}
int year()const {return yy();}
int month()const{return mm();}
int day()const{return dd();}
int year(int y1){return yy(y1);}
int month(int m1){return mm(m1);}
int day(int d1){return dd(d1);}
};
5
#include<bits/stdc++.h>
using namespace std;
int main()
{
multiset<int> p;
int N;
while(cin>>N&&N){
p.clear();
while(N--){
char s;
cin>>s;
if(s=='B'){
int a;
cin>>a;
p.insert(a);
}
if(s=='G'){
cout<<*p.begin()<<endl;
p.erase(p.begin());
}
}
}
return 0;
}
6
#include<bits/stdc++.h>
using namespace std;
multiset<int> p;
int main()
{
int n,memn;
char c;
multiset<int>::iterator it;
while(cin>>n&&n){
p.clear();
for(int i=0;i<n;i++){
cin>>c;
if(c=='i'){
cin>>memn;
p.insert(memn);
}
else if(c=='d'){
cin>>memn;
for(it=p.begin();it!=p.end();it++)
if(*it==memn) break;
p.erase(it);
}
}
it=p.begin();
if(p.begin()==p.end()) continue;
cout<<*it;
for(++it;it!=p.end();++it) cout<<" "<<*it;
cout<<endl;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
multiset<int> p;
int main()
{
int n,memn;
char c;
multiset<int>::iterator it;
while(cin>>n&&n){
p.clear();
for(int i=0;i<n;i++){
cin>>c;
if(c=='i'){
cin>>memn;
p.insert(memn);
}
else if(c=='d'){
cin>>memn;
for(it=p.begin();it!=p.end();)
if(*it==memn) { p.erase(it++); break; } else it++;
}
}
it=p.begin();
if(p.begin()==p.end()) continue;
cout<<*it;
for(++it;it!=p.end();++it) cout<<" "<<*it;
cout<<endl;
}
return 0;
}