良心评测机

这是一道队列和栈的题。

对于所有提交用一个队列维护,而每个选手的提交分别用一个栈来维护,再开一个标记数组标记提交是否已评测即可。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <bits/stdc++.h>
using namespace std;

using ll=long long;

ll n, id;
string tmp;
queue<array<int,3>> q;
stack<array<int,2>> st[(int)1e5+9];
bitset<(int)1e6+9> vis;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=1,op,uid;i<=n;++i){
cin>>op;
if(op==1){
cin>>uid>>tmp;
q.push({uid,i,tmp == "CORRECT"});
st[uid].push({i,tmp == "CORRECT"});
}else{
if(id){
while(!st[id].empty()&&vis[st[id].top()[0]])st[id].pop();
if(!st[id].empty()){
auto [aa,bb]=st[id].top();st[id].pop();

cout<<aa<<"\n";
vis[aa]=true;
if(!bb)id=0;
continue;
}
}

while(!q.empty()&&vis[q.front()[1]])q.pop();

if(!q.empty()){
auto [aa,bb,cc] = q.front();q.pop();

cout<<bb<<"\n";
vis[bb]=true;

if(cc)id=aa;
else id=0;

}else cout<<"NOTHING HAPPENED\n";
}
}
return 0;
}

寻径指津

这是一道bfs题目,因为无压力桩的版本已经在22年的萌新赛出过,所以今天的是有压力桩的版本。

用一个三维数组维护位置为在地图的压力桩为状态下的最短路即可,剩下部分就是一个bfs板子了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

#include <bits/stdc++.h>
using namespace std;

using pii=pair<int,int>;
using ll=long long;

constexpr int N = 109;

constexpr pii dirs[]={{1,0},{0,1},{-1,0},{0,-1}};

pii st,en;

int a[N][N],n,m,tot;
int dis[N][N][1<<11],vis[N][N][1<<11],ans=0x3f3f3f3f;
pair<array<int,3>,char> lst[N][N][1<<11];
map<pii,char> covdirs;
char c;
map<pii,int> ylz;
pii cov[20];

queue<array<int,3>> q;

int add(int x,int y){
if(ylz.count({x,y}))return 1ll<<ylz[{x,y}];
else return 0;
}

void solmp(int x,int sta){
if(sta){
for(int i=0;i<10;++i)if((x>>i)&1){
auto [xx,yy]=cov[i];
a[xx][yy]=2;
}
}else{
for(int i=0;i<10;++i)if((x>>i)&1){
auto [xx,yy]=cov[i];
a[xx][yy]=3;
}
}
}

int main()
{
{
covdirs[{-1,0}]='U';
covdirs[{1,0}]='D';
covdirs[{0,-1}]='L';
covdirs[{0,1}]='R';
}

memset(dis,0x3f,sizeof(dis));
scanf("%d%d",&n,&m);
for(int i=1;i<=n;++i)for(int j=1;j<=m;++j){
scanf(" %c",&c);
if(c=='.')a[i][j]=1;
else if(c=='#')a[i][j]=2;
else if(c=='?'){
a[i][j]=3,ylz[{i,j}]=tot,cov[tot]={i,j};
tot+=1;
}
else if(c=='S')a[i][j]=4,st={i,j};
else a[i][j]=5,en={i,j};
}
dis[st.first][st.second][0]=0;
q.push({st.first,st.second,0});

while(!q.empty()){
auto [aa,bb,cc]=q.front();q.pop();
if(vis[aa][bb][cc])continue;
vis[aa][bb][cc]=1;

solmp(cc,1);
for(auto [xx,yy]:dirs){
int ta=aa,tb=bb,tc=cc;


while(a[ta+xx][tb+yy]!=2){
tc|=add(ta,tb);
ta+=xx,tb+=yy;
if((pii){ta,tb}==en)break;
}
if(dis[ta][tb][tc]>dis[aa][bb][cc]+1)dis[ta][tb][tc]=dis[aa][bb][cc]+1,lst[ta][tb][tc]={{aa,bb,cc},covdirs[{xx,yy}]};
if((pii){ta,tb}==en){
ans=min(ans,dis[ta][tb][tc]);
}else q.push({ta,tb,tc});
}
solmp(cc,0);
}

if(ans==0x3f3f3f3f){
printf("-1\n");
}else{
printf("%d\n",ans);

vector<char> res;

for(int i=0;i<(1ll<<10);++i){
if(dis[en.first][en.second][i] == ans){
auto [aa,bb]=en;int cc=i;
while((pii){aa,bb}!=st){
auto [tx,ty]=lst[aa][bb][cc];
res.push_back(ty);
aa=tx[0],bb=tx[1],cc=tx[2];
}
break;
}
}
reverse(res.begin(),res.end());
for(auto it:res)printf("%c\n",it);

}

return 0;
}

获取抽卡链接

1
./adb logcat  -e "OnGetWebViewPageFinish.+https.+"  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// 替换选择器字符串以匹配目标按钮
var buttonSelector = '#query_ticket';


function getRandomInterval(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}


// 查找按钮并定义点击函数
var button = document.querySelector(buttonSelector);
function clickButton() {
if (button) {
button.click();
console.log('Button clicked!');
} else {
console.log('Button not found');
}
}

// 设置定时器定期点击按钮
var intervalId = setInterval(clickButton, getRandomInterval(15000, 20000));

// 如果需要停止定时点击,可以使用以下命令
// clearInterval(intervalId);

好像vercel的服务访问变正常了。


重写了一遍这题。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#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 n, c[(int)1e5+9], son[(int)1e5+9], cnt[(int)1e5+9], res[(int)1e5+9], ans, ma, sz[(int)1e5+9], dfn_cnt, dfn[(int)1e5+9], ori[(int)1e5+9];
vector<int> g[(int)1e5+9];

void dfs(int u, int fa){
sz[u]=1,dfn[u]=++dfn_cnt,ori[dfn[u]]=u;
for(auto it:g[u])if(it!=fa){
dfs(it,u);
sz[u]+=sz[it];
son[u]=sz[son[u]]<sz[it]?it:son[u];
}
}


void dsu(int u, int fa,int sta){
for(auto it:g[u])if(it!=fa&&it!=son[u]){
dsu(it,u,0);
}
if(son[u])dsu(son[u],u,1);
for(auto it:g[u])if(it!=fa&&it!=son[u]){
for(int i=dfn[it];i<dfn[it]+sz[it];++i){
cnt[c[ori[i]]]+=1;
if(cnt[c[ori[i]]] > ma){
ma = cnt[c[ori[i]]], ans=c[ori[i]];
}else if(cnt[c[ori[i]]] == ma){
ans+=c[ori[i]];
}
}
}

{
cnt[c[u]]+=1;
if(cnt[c[u]] > ma){
ma = cnt[c[u]], ans=c[u];
}else if(cnt[c[u]] == ma){
ans+=c[u];
}
}

res[u]=ans;

if(!sta){
for(int i=dfn[u];i<sz[u]+dfn[u];++i)cnt[c[ori[i]]]-=1;
ma=ans=0;
}


}

int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=1;i<=n;++i)cin>>c[i];
for(int i=1,x,y;i<n;++i){
cin>>x>>y;
g[x].push_back(y),g[y].push_back(x);
}

dfs(1,0);
dsu(1,0,0);

for(int i=1;i<=n;++i)cout<<res[i]<<" \n"[i==n];

return 0;
}

由于不可抗力原因,vercel从10.1凌晨开始被🧱,因此本站所有搭在 vercel 上服务都是ERR_CONNECTION_RESET状态。

而且目前还没有找到好的白嫖对象,只能靠套个cf勉强访问 cf镜像

0%