4428. 字符串
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
int n;
cin>>n;
cin>>s;
map<int,int>mp;
for(int i=0;i<s.size();i++)
{
if(s[i]>='a'&&s[i]<='z')mp[s[i]-'a']++;
if(s[i]>='A'&&s[i]<='Z')mp[s[i]-'A']++;
}
if(mp.size()==26)cout<<"YES";
else cout<<"NO";
}
4429. 无线网络
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
#define x first
#define y second
#define LL long long
#define int LL
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define PII pair<int,int>
#define LL_INF 0x7f7f7f7f7f7f7f7f
#define INF 0x3f3f3f3f
#define debug(x) cerr << #x << ": " << x << endl
#define io ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
LL Mod(LL a,LL mod){return (a%mod+mod)%mod;}
LL lowbit(LL x){return x&-x;}
LL qmi(LL a,LL b,LL mod) {LL ans = 1; while(b){ if(b & 1) ans = ans * (a % mod) % mod; a = a % mod * (a % mod) % mod; b >>= 1;} return ans; }
int _;
PII s1,s2;
int dist(PII a,PII b)
{
return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
void solve()
{
int n,x1,y1,x2,y2;
cin>>n>>x1>>y1>>x2>>y2;
vector<PII>v(n+1);
s1.x=x1,s1.y=y1,s2.x=x2,s2.y=y2;
for(int i=1;i<=n;i++)
{
int x,y;
cin>>x>>y;
v[i].x=dist({x,y},s1),v[i].y=dist({x,y},s2);
}
sort(all(v));
int res=LL_INF;
v[0]={0,0};
for(int i=0;i<=n;i++)
{
int d1=v[i].x;
int maxv=0;
for(int j=0;j<=n;j++)
{
int d2=v[j].y;
if(v[j].x<=d1)continue;
maxv=max(maxv,d2);
}
res=min(res,maxv+d1);
}
cout<<res<<endl;
}
signed main()
{
io;
solve();
return 0;
}
4430. 括号序列
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
#define x first
#define y second
#define LL long long
#define int LL
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define PII pair<int,int>
#define ll_INF 0x7f7f7f7f7f7f7f7f
#define INF 0x3f3f3f3f
#define debug(x) cerr << #x << ": " << x << endl
#define io ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
LL Mod(LL a,LL mod){return (a%mod+mod)%mod;}
LL lowbit(LL x){return x&-x;}
LL qmi(LL a,LL b,LL mod) {LL ans = 1; while(b){ if(b & 1) ans = ans * (a % mod) % mod; a = a % mod * (a % mod) % mod; b >>= 1;} return ans; }
int _;
int n;
string s;
int judge()
{
int cnt=0,r=0;
for(int i=0;i<n;i++)
{
if(s[i]=='(')cnt++;
else
{
cnt--;
r++;
if(cnt<0)
{
cnt+=2;
for(int j=i+1;j<n;j++)
{
if(s[j]=='(')cnt++;
else
{
cnt--;
if(cnt<0)return 0;
}
}
return r;
}
}
}
}
void solve()
{
cin>>n;
cin>>s;
int l=0,r=0;
for(auto x:s)
if(x=='(')l++;
else r++;
if(r==2+l)cout<<judge()<<endl;
else if(l==r+2)
{
reverse(all(s));
for(int i=0;i<n;i++)
if(s[i]=='(')s[i]=')';
else s[i]='(';
cout<<judge()<<endl;
}
else cout<<0<<endl;
}
signed main()
{
io;
solve();
return 0;
}