P7742
这题就是一个模拟。我们只需要模拟题目中给出的四个过程,把
怎么模拟呢?很简单:把箭头指针指向指定频道,让该频道一个一个网上移即可。
因为本题偏要搞特殊有特殊性,所以我们只需要 当作空气即可。
AC Code:
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=3e5+15,M=2e3+15,mod=19650827;
int n,tot=1;
string s[N];
void print(string s2,int k){
while(s[tot]!=s2){
tot++;
putchar('1');
}
while(tot>k){
swap(s[tot],s[tot-1]);
tot--;
putchar('4');
}
}
signed main(){
scanf("%lld",&n);
int tot;
for(int i=1;i<=n;++i){
cin>>s[i];
}
print("BLJTV1",1);
print("BLJTV2",2);
return 0;
}
注:借鉴了神犇 yeshubo_qwq 的思路。
若本题解审核通过,这将是本人在主题库的第一篇题解,所以希望管理员过一下,谢谢。