还好光荣下班?
A:
#include <bits/stdc++.h>
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
*/
using namespace std;
const double eps = 1e-10;
const double pi = 3.1415926535897932384626433832795;
const double eln = 2.718281828459045235360287471352;
#define f(i, a, b) for (int i = a; i <= b; i++)
#define scan(x) scanf("%d", &x)
#define mp make_pair
#define pb push_back
#define lowbit(x) (x&(-x))
#define fi first
#define se second
#define SZ(x) int((x).size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define summ(a) (accumulate(all(a), 0ll))
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
using ll=long long;
ll tt,n;
string s;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>tt;
f(sb,1,tt){
cin>>n>>s;
string ss="Timur";
map<char,int> cn;
int ok=1;
for(auto it:ss){cn[it]+=1;}
for(auto it:s){cn[it]-=1;}
for(auto [aa,bb]:cn)if(bb){ok=0;}
cout<<(ok?"YES\n":"NO\n");
}
return 0;
}
B:
#include <bits/stdc++.h>
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
*/
using namespace std;
const double eps = 1e-10;
const double pi = 3.1415926535897932384626433832795;
const double eln = 2.718281828459045235360287471352;
#define f(i, a, b) for (int i = a; i <= b; i++)
#define scan(x) scanf("%d", &x)
#define mp make_pair
#define pb push_back
#define lowbit(x) (x&(-x))
#define fi first
#define se second
#define SZ(x) int((x).size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define summ(a) (accumulate(all(a), 0ll))
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
using ll=long long;
ll tt,n;
string s1,s2;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>tt;
f(sb,1,tt){
cin>>n>>s1>>s2;
bool ok=false;
for(int i=0;i<n;++i){
if((s1[i]=='R'&&s2[i]!='R')||(s2[i]=='R'&&s1[i]!='R')){
ok=true;
}
}
cout<<(ok?"NO\n":"YES\n");
}
return 0;
}
C:
#include <bits/stdc++.h>
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
*/
using namespace std;
const double eps = 1e-10;
const double pi = 3.1415926535897932384626433832795;
const double eln = 2.718281828459045235360287471352;
#define f(i, a, b) for (int i = a; i <= b; i++)
#define scan(x) scanf("%d", &x)
#define mp make_pair
#define pb push_back
#define lowbit(x) (x&(-x))
#define fi first
#define se second
#define SZ(x) int((x).size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define summ(a) (accumulate(all(a), 0ll))
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
using ll=long long;
ll tt,n;
string s;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>tt;
f(sb,1,tt){
cin>>n;
map<string,int>cn;
ll ans1=0,ans2=0,ans3=0;
for(int i=0;i<3;++i){
for(int j=1;j<=n;++j){
cin>>s;
cn[s]|=(1<<i);
}
}
for(auto [aa,bb]:cn){
bitset<4> v(bb);
if(v.count()==3)continue;
else if(v.count()==2){
if(1&bb)ans1+=1;
if(2&bb)ans2+=1;
if(4&bb)ans3+=1;
}else if(v.count()==1){
if(1&bb)ans1+=3;
if(2&bb)ans2+=3;
if(4&bb)ans3+=3;
}
}
cout<<ans1<<" "<<ans2<<" "<<ans3<<"\n";
}
return 0;
}
D:
#include <bits/stdc++.h>
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
*/
using namespace std;
const double eps = 1e-10;
const double pi = 3.1415926535897932384626433832795;
const double eln = 2.718281828459045235360287471352;
#define f(i, a, b) for (int i = a; i <= b; i++)
#define scan(x) scanf("%d", &x)
#define mp make_pair
#define pb push_back
#define lowbit(x) (x&(-x))
#define fi first
#define se second
#define SZ(x) int((x).size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define summ(a) (accumulate(all(a), 0ll))
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
using ll=long long;
ll tt,n;
string s;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>tt;
f(sb,1,tt){
cin>>n>>s;
ll ans=0,tmp=n,l=0,r=n-1;
for(int i=0;i<n;++i){
if(s[i]=='L')ans+=i;
else ans+=n-i-1;
}
while(l<r){
if(s[l]=='L'){
s[l]='R';
tmp-=1;
ans+=n-2*l-1;
cout<<ans<<' ';
}
l+=1;
if(s[r]=='R'){
s[r]='L';
tmp-=1;
ans+=2*r-n+1;
cout<<ans<<" ";
}
r-=1;
}
for(int i=1;i<=tmp;++i)cout<<ans<<" ";
cout<<"\n";
}
return 0;
}
E:
#include <bits/stdc++.h>
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
*/
using namespace std;
const double eps = 1e-10;
const double pi = 3.1415926535897932384626433832795;
const double eln = 2.718281828459045235360287471352;
#define f(i, a, b) for (int i = a; i <= b; i++)
#define scan(x) scanf("%d", &x)
#define mp make_pair
#define pb push_back
#define lowbit(x) (x&(-x))
#define fi first
#define se second
#define SZ(x) int((x).size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define summ(a) (accumulate(all(a), 0ll))
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
using ll=long long;
ll tt,n,q,a[1009][1009],s[1009][1009];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>tt;
f(sb,1,tt){
cin>>n>>q;
for(int i=1;i<=1000;++i)for(int j=1;j<=1000;++j)a[i][j]=0;
for(int i=1,x,y;i<=n;++i)cin>>x>>y,a[x][y]+=1;
for(int i=1;i<=1000;++i)for(int j=1;j<=1000;++j){
s[i][j]=s[i][j-1]+a[i][j]*i*j;
//cerr<<i<<"::"<<j<<"_"<<s[i][j]<<"\n";
}
//cout<<s[2][5]<<"\n";
for(int i=1,x,y,z,w;i<=q;++i){
cin>>x>>y>>z>>w;
ll ans=0;
for(int i=x+1;i<z;++i){
ans+=s[i][w-1]-s[i][y];
//cout<<w-1<<"::"<<y<<"\n";
}
cout<<ans<<"\n";
}
}
return 0;
}
F:
#include <bits/stdc++.h>
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
*/
using namespace std;
const double eps = 1e-10;
const double pi = 3.1415926535897932384626433832795;
const double eln = 2.718281828459045235360287471352;
#define f(i, a, b) for (int i = a; i <= b; i++)
#define scan(x) scanf("%d", &x)
#define mp make_pair
#define pb push_back
#define lowbit(x) (x&(-x))
#define fi first
#define se second
#define SZ(x) int((x).size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define summ(a) (accumulate(all(a), 0ll))
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
using ll=long long;
ll tt,n,m;
char s[60][60];
pii dir[4]={{1,0},{0,1},{-1,0},{0,-1}};
pii dirs[8]={{1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,-1},{1,-1},{-1,1}};
vector<pii> v;
void dfs(int x,int y){
if(x<=0||y<=0||x>n||y>m)return ;
v.push_back({x,y});
s[x][y]='.';
if(v.size()>3)return;
for(auto [aa,bb]:dir){
aa+=x,bb+=y;
if(s[aa][bb]=='*')dfs(aa,bb);
}
}
bool solve(){
for(int i=1;i<=n;++i){
for(int j=1;j<=m;++j){
if(s[i][j]=='*'){
dfs(i,j);
if(v.size()!=3)return false;
sort(all(v));
int mix=0x3f3f3f3f,miy=0x3f3f3f3f,maax=-1,may=-1;
for(auto [aa,bb]:v)mix=min(mix,aa),maax=max(maax,aa),miy=min(miy,bb),may=max(may,bb);
//for(auto [aa,bb]:v)cerr<<aa<<"::"<<bb<<"\n";
if(!(mix==maax-1&&miy==may-1))return false;
for(auto [aa,bb]:v){
//cout<<aa<<bb<<"PPPP\n";
for(auto [x,y]:dirs){
x+=aa,y+=bb;
if(x<=0||y<=0||x>n||y>m)continue;
if(s[x][y]=='*')return false;
//cout<<x<<"::"<<y<<"__"<<s[x][y]<<"\n";
}
}
v.clear();
}
}
}
return true;
}
int main()
{
scanf("%lld",&tt);
f(sb,1,tt){
v.clear();
scanf("%lld%lld",&n,&m);
for(int i=1;i<=n;++i)for(int j=1;j<=m;++j){
char c;
scanf(" %c",&c);
s[i][j]=c;
}
printf("%s",solve()?"YES\n":"NO\n");
}
return 0;
}
G:
#include <bits/stdc++.h>
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
*/
using namespace std;
const double eps = 1e-10;
const double pi = 3.1415926535897932384626433832795;
const double eln = 2.718281828459045235360287471352;
#define f(i, a, b) for (int i = a; i <= b; i++)
#define scan(x) scanf("%d", &x)
#define mp make_pair
#define pb push_back
#define lowbit(x) (x&(-x))
#define fi first
#define se second
#define SZ(x) int((x).size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define summ(a) (accumulate(all(a), 0ll))
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
using ll=long long;
ll tt,n,a[(int)2e5+9];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>tt;
f(sb,1,tt){
cin>>n;
if(n==3){
cout<<"2 1 3\n";
}else {
ll cn=n/4*4,st=n-cn;
for(int i=1;i<=cn;++i)a[i]=i+3;
ll bit=0;
while((1ll<<bit)<=cn+3)bit+=1;
ll tmp=1ll<<bit;
tmp*=2;
//cerr<<tmp<<"___\n";
if(st==1){
a[n]=tmp,a[n-2]|=tmp;
}
else if(st==2){
a[n]=tmp|(cn+4),a[n-1]=cn+4,a[n-2]|=tmp;
}else if(st==3){
a[n]=tmp,a[n-2]=tmp|(cn+4),a[n-1]=cn+4;
}
f(i,1,n)cout<<a[i]<<" \n"[i==n];
}
}
return 0;
}