秦皇岛手机网站制作费用优化是什么
news/
2025/10/7 18:36:04/
文章来源:
秦皇岛手机网站制作费用,优化是什么,网络营销外包团队哪些好,phpcms多个网站Mirrored String II 看到题解说是马拉车算法#xff0c;我赛时并没想到#xff08;好吧其实我是比赛完才知道有马拉车这个算法#xff09;
因为字符串的长度只有1000#xff0c;直接暴力跑其实就可以了#xff0c;但是要注意的是#xff1b;回文串有俩种形式#xff0c…Mirrored String II 看到题解说是马拉车算法我赛时并没想到好吧其实我是比赛完才知道有马拉车这个算法
因为字符串的长度只有1000直接暴力跑其实就可以了但是要注意的是回文串有俩种形式一种是aba的另一种是baab的形式这是需要注意的地方
//#pragma GCC optimize(3) //O2优化开启
#includeiostream
#includecmath
#includecstring
#includecstdio
#includestack
#includestring
#includealgorithm
//#includeunordered_map
#includemap
#includebitset
#includecstring
//#include unordered_set
//#includepriority_queue
#includequeue
#includedeque
#includeset
#includestdlib.h
#define dbug cout*****hear*****endl;
#define rep(a,b,c) for(ll ab;ac;a)
#define per(a,b,c) for(ll ab;ac;a--)
#define no coutNoendl;
#define yes coutYesendl;
//#define endl \n//交互题一定要关
#define lowbit(x) (x-x)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//priority_queueint,vectorint,greaterint q;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pairll, ll PII;
typedef pairlong double, long double PDD;
ll INF 0x3f3f3f3f;
//const ll LINFLLONG_MAX;
// int get_len(int x1,int y1,int x2,int y2)
// {
// return (x2-x1)*(x2-x1) (y2-y1)*(y2-y1);
// }
const ll N 2e5 10;
const ll mod1 998244353;
const ll mod2 1e9 7;
const ll hash_num 3e9 9;
ll n, m, ca;
ll arr[N], brr[N], crr[N], drr[N];
//ll h[N],ne[N],e[N],w[N],book[N],idx;
// void add(ll a, ll b , ll c)
// {
// e[idx] b, w[idx] c,ne[idx] h[a], h[a] idx ;
// }
vectorllve[N];
bool check(char x)
{if (xA||x H || x I || x M || x O || x T || x U || x V || x W || x X || x Y)return 1;return 0;
}
void solve()
{string s;cin s;ll len s.size();rep(i, 0, len){arr[i] 0, brr[i] 0;}rep(i, 0, len - 1){if (check(s[i])){arr[i] 1;ll l i - 1;ll r i 1;while (l 0 r len){if (check(s[l]) s[r] s[l]){l--;r;arr[i] 2;}else{break;}}if (check(s[i1] ) s[i] s[i 1]){brr[i] 2;ll l i - 1;ll r i 2;while (l 0 r len){if (check(s[l]) s[r] s[l]){l--;r;brr[i] 2;}else{break;}}}}}sort(arr, arr len);sort(brr, brr len);cout max(arr[len - 1], brr[len - 1]) endl;;
}int main()
{IOS;ll _;_ 1; //scanf(%lld,_);cin _;ca 1;while (_--){solve();ca;}return 0;
}Competitive Seagulls 这是一个博弈废话大家叫这种博弈为对称博弈
本题对称 博弈的特性如下
对于给定的长度n我们可以先取中间的一段使左右两边的白色方格一样多这样后手取其中一边我们就可以在另一边取和他相同的长度这样我们是必赢的,因为不管奇数还是偶数个我们可以取2或3使左右两边相等。但是对于2和3不同只有这两种情况我们是先手必输的。
void solve()
{cin n;if(n2 || n3){cout second endl;}else{cout first endl;}
} Hey JUDgE
每次输入的长度只有7个而比赛需要的题目数量是5所以最多只能组合俩次题目又因为题目不能重复利用新得到的题目也无法再次组合所以就直接枚举就可以找到答案
//#pragma GCC optimize(3) //O2优化开启
#includeiostream
#includecmath
#includecstring
#includecstdio
#includestack
#includestring
#includealgorithm
//#includeunordered_map
#includemap
#includebitset
#includecstring
//#include unordered_set
//#includepriority_queue
#includequeue
#includedeque
#includeset
#includestdlib.h
#define dbug cout*****hear*****endl;
#define rep(a,b,c) for(ll ab;ac;a)
#define per(a,b,c) for(ll ab;ac;a--)
#define no coutNoendl;
#define yes coutYesendl;
//#define endl \n//交互题一定要关
#define lowbit(x) (x-x)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//priority_queueint,vectorint,greaterint q;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pairll, ll PII;
typedef pairlong double, long double PDD;
ll INF 0x3f3f3f3f;
//const ll LINFLLONG_MAX;
// int get_len(int x1,int y1,int x2,int y2)
// {
// return (x2-x1)*(x2-x1) (y2-y1)*(y2-y1);
// }
const ll N 2e5 10;
const ll mod1 998244353;
const ll mod2 1e9 7;
const ll hash_num 3e9 9;
ll n, m, ca;
ll arr[N], brr[N], crr[N], drr[N];
//ll h[N],ne[N],e[N],w[N],book[N],idx;
// void add(ll a, ll b , ll c)
// {
// e[idx] b, w[idx] c,ne[idx] h[a], h[a] idx ;
// }
ll book[N];
ll get_hard(char a)
{brr[A] 1;brr[B] 2;brr[C] 3;brr[D] 4;brr[E] 5;return brr[a];
}
void solve()
{string s;cin s;mapll, llmp;rep(i, 0, s.size() - 1){mp[get_hard(s[i])] ;arr[i 1] get_hard(s[i]);}ll num 0;rep(i, 1, 5){// cout arr[i] ;if (!mp[i])num;}if (num 0){cout YES endl;return;}ll xx;ll yy 0;rep(i, 1, 7){rep(j, i 1, 7){xx 1;mp[arr[i]]--, mp[arr[j]]--, mp[arr[i] arr[j]];rep(k, 1, 5){if (!mp[k])xx 0;}mp[arr[i]], mp[arr[j]], mp[arr[i] arr[j]]--;if (xx 1)yy 1;}}if (!yy){rep(i, 1, 7){rep(j, i 1, 7){rep(k, 1, 7){rep(l, k 1, 7){xx 1;if (i k || j l || i l || j k)continue;mp[arr[i]]--, mp[arr[j]]--, mp[arr[i] arr[j]];mp[arr[k]]--, mp[arr[l]]--, mp[arr[k] arr[l]];rep(mm, 1, 5){if (!mp[mm])xx 0;}mp[arr[i]], mp[arr[j]], mp[arr[i] arr[j]]--;mp[arr[k]], mp[arr[l]], mp[arr[k] arr[l]]--;if (xx 1){// cout i j k l endl;yy 1;}}}}}}if (yy){cout YES endl;}else{cout NO endl;}
}int main()
{IOS;ll _;_ 1; //scanf(%lld,_);cin _;ca 1;while (_--){solve();ca;}return 0;
}Smooth Developer 很水的一个模拟但是诶您没猜到吧我从开始接触到正式ac前后跨了4h。
唯一需要注意的就是所需要的函数要全部标记完之后再输出而不是有一个输出一个
//#pragma GCC optimize(3) //O2优化开启
#includeiostream
#includecmath
#includecstring
#includecstdio
#includestack
#includestring
#includealgorithm
//#includeunordered_map
#includemap
#includebitset
#includecstring
//#include unordered_set
//#includepriority_queue
#includequeue
#includedeque
#includeset
#includestdlib.h
#define dbug cout*****hear*****endl;
#define rep(a,b,c) for(ll ab;ac;a)
#define per(a,b,c) for(ll ab;ac;a--)
#define no coutNoendl;
#define yes coutYesendl;
//#define endl \n//交互题一定要关
#define lowbit(x) (x-x)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//priority_queueint,vectorint,greaterint q;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pairll, ll PII;
typedef pairlong double, long double PDD;
ll INF 0x3f3f3f3f;
//const ll LINFLLONG_MAX;
// int get_len(int x1,int y1,int x2,int y2)
// {
// return (x2-x1)*(x2-x1) (y2-y1)*(y2-y1);
// }
const ll N 2e5 10;
const ll mod1 998244353;
const ll mod2 1e9 7;
const ll hash_num 3e9 9;
ll n, m, ca;
ll arr[N], brr[N], crr[N], drr[N];
//ll h[N],ne[N],e[N],w[N],book[N],idx;
// void add(ll a, ll b , ll c)
// {
// e[idx] b, w[idx] c,ne[idx] h[a], h[a] idx ;
// }
mapstring, llmp;
vectorllve[N];
char x[30], s[N][30];
ll book[N];
void dfs(ll u)
{book[u] 1;for (auto it : ve[u]){if (book[it])continue;dfs(it);}}void solve()
{scanf(%lld%lld, n, m);rep(i, 1, n)ve[i].clear();mp.clear();rep(i, 1, n){scanf(%s, s[i]);mp[s[i]] i;ll num;scanf(%lld, num);rep(j, 1, num){scanf(%s, x);if (mp[x] ! i){ve[i].push_back(mp[x]);}}}memset(book, 0, sizeof book);while (m--){scanf(%s, x);if(!book[mp[x]])dfs(mp[x]);}rep(i, 1, n){if (book[i]){printf(%s\n, s[i]);}}
}int main()
{//IOS;ll _;_ 1; scanf(%lld, _);//cin _;ca 1;while (_--){solve();ca;}return 0;
}ACPC Headquarters : AASTMT (Stairway to Heaven) 换个想法我们不抓着比赛名称看我们就抓着志愿者看数据很小只有365当得知一个志愿者有需要参加的比赛的时候就遍历一遍是否有矛盾的存在矛盾的储存下来就OK了
//#pragma GCC optimize(3) //O2优化开启
#includeiostream
#includecmath
#includecstring
#includecstdio
#includestack
#includestring
#includealgorithm
//#includeunordered_map
#includemap
#includebitset
#includecstring
//#include unordered_set
//#includepriority_queue
#includequeue
#includedeque
#includeset
#includestdlib.h
#define dbug cout*****hear*****endl;
#define rep(a,b,c) for(ll ab;ac;a)
#define per(a,b,c) for(ll ab;ac;a--)
#define no coutNoendl;
#define yes coutYesendl;
//#define endl \n//交互题一定要关
#define lowbit(x) (x-x)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//priority_queueint,vectorint,greaterint q;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pairll, ll PII;
typedef pairlong double, long double PDD;
ll INF 0x3f3f3f3f;
//const ll LINFLLONG_MAX;
// int get_len(int x1,int y1,int x2,int y2)
// {
// return (x2-x1)*(x2-x1) (y2-y1)*(y2-y1);
// }
const ll N 2e5 10;
const ll mod1 998244353;
const ll mod2 1e9 7;
const ll hash_num 3e9 9;
ll n, m, ca;
ll arr[N], brr[N], crr[N], drr[N];
//ll h[N],ne[N],e[N],w[N],book[N],idx;
// void add(ll a, ll b , ll c)
// {
// e[idx] b, w[idx] c,ne[idx] h[a], h[a] idx ;
// }map string, vectorPIImp;setstring se;
void solve()
{cin n;mp.clear();se.clear();rep(i, 1, n){string name;ll l, r, num;cin name l r num;rep(j, 1, num){string pename;cin pename;for (ll k 0;k mp[pename].size();k){if (mp[pename][k].first l l mp[pename][k].second){se.insert(pename);}else if (mp[pename][k].first r mp[pename][k].second r){se.insert(pename);}else if (l mp[pename][k].first r mp[pename][k].second){se.insert(pename);}}mp[pename].push_back({ l,r });}}cout se.size() endl;for (auto it : se){cout it endl;}
}int main()
{IOS;ll _;_ 1; //scanf(%lld,_);cin _;ca 1;while (_--){solve();ca;}return 0;
}
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/930718.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!