1.队列Q (nowcoder.com)
//1.
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+6;
const int inf=0x3f3f3f3f;
int dir[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
const double pi=acos(-1.0);
int a[N],b[N];
bool cmp(int xx,int yy)
{return b[xx]<b[yy];
}
void solve()
{int n;cin>>n;for(int i=0;i<n;i++){cin>>a[i];b[a[i]]=i;}int t=1;cin>>t;int l=0,r=n;while(t--){string s;int x;cin>>s>>x;if(s=="FIRST")b[x]=--l;else b[x]=++r;}sort(a,a+n,cmp);for(int i=0;i<n;i++)cout<<a[i]<<' ';
}
signed main()
{//ios_base::sync_with_stdio(false);//cin.tie(nullptr),cout.tie(nullptr);int t=1;//cin>>t;while(t--){solve();}return 0;
}
//2.
//会超时:
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+6;
const int inf=0x3f3f3f3f;
typedef pair<int,int> pii;
int dir[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
const double pi=acos(-1.0);
bool cmp(pii xx,pii yy)
{return xx.second<yy.second;
}
void solve()
{int n;cin>>n;vector<pii>ve(n);for(int i=0;i<n;i++){cin>>ve[i].first;ve[i].second=i;}int t;cin>>t;int l=0,r=n;while(t--){string s;int x;cin>>s>>x;if(s=="FIRST"){for(auto it:ve){if(it.first==x){--l;it.second=l;break;}}}else{for(auto it:ve){if(it.first==x){++r;it.second=r;break;}}}}sort(ve.begin(),ve.end(),cmp);for(auto it:ve)cout<<it.first<<' '<<it.second<<endl;
}
signed main()
{//ios_base::sync_with_stdio(false);//cin.tie(nullptr),cout.tie(nullptr);int t=1;//cin>>t;while(t--){solve();}return 0;
}
//3.
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+6;
const int inf=0x3f3f3f3f;
int dir[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
const double pi=acos(-1.0);
map<int,int>mp1,mp2;
void solve()
{int n,x;cin>>n;for(int i=0;i<n;i++){cin>>x;mp1[x]=i;mp2[i]=x;}int t;cin>>t;int l=0,r=n;while(t--){string s;int x;cin>>s>>x;mp2[mp1[x]]=0;if(s=="FIRST"){l--;mp2[l]=x;mp1[x]=l;}else{r++;mp2[r]=x;mp1[x]=r;}}for(int i=l;i<=r;i++){if(mp2[i])cout<<mp2[i]<<' ';}
}
signed main()
{//ios_base::sync_with_stdio(false);//cin.tie(nullptr),cout.tie(nullptr);int t=1;//cin>>t;while(t--){solve();}return 0;
}
2.12.货物摆放 - 蓝桥云课 (lanqiao.cn)
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+6;
const int inf=0x3f3f3f3f;
int dir1[8][2]={{0,1},{0,-1},{-1,0},{1,0},{1,1},{-1,-1},{1,-1},{-1,1}};
int dir2[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
int a[N];
//round(a)
//int a=strtoll(s.c_str(),NULL,10);
void solve()
{int cn=0,r=0,n=2021041820210418;for(int i=1;i*i<=n;i++){if(n%i==0){a[++r]=i;if(n/i!=i){a[++r]=n/i;}}}for(int i=1;i<=r;i++){for(int j=1;j<=r;j++){for(int k=1;k<=r;k++){if(a[i]*a[j]*a[k]==n)cn++;}}}cout<<cn;
}
signed main()
{//ios_base::sync_with_stdio(false);//cin.tie(0),cout.tie(0);int t=1;//cin>>t;while(t--){solve();}return 0;
}
3.2.工作时长 - 蓝桥云课 (lanqiao.cn)
//......excel......#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+6;
const int inf=0x3f3f3f3f;
int dir1[8][2]={{0,1},{0,-1},{-1,0},{1,0},{1,1},{-1,-1},{1,-1},{-1,1}};
int dir2[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
int a[1100][1100],b[1100][1100];
//round(a)
//int a=strtoll(s.c_str(),NULL,10);
void solve()
{cout<<1417*60*60+11*60+53;
}
signed main()
{//ios_base::sync_with_stdio(false);//cin.tie(0),cout.tie(0);int t=1;//cin>>t;while(t--){solve();}return 0;
}