2024.3.27 【如此生活三十年,直到大厦崩塌】
Wednesday 二月十八
P8818 CSP-S 2022 策略游戏
//2024.3.27
//by white_ice
#include<bits/stdc++.h>
using namespace std;
#define int long long
int jntm(int a,int b){return a>b?a:b;}
bool gmx(int &a,int b){return b>a?a=b,true:false;}
int ngm (int a,int b){return a<b?a:b;}
const int maxinf=LONG_LONG_MAX;
const int mininf=LONG_LONG_MIN;
const int oo = 100005;
const int op = 25;
int amx[oo][op], amn[oo][op];
int afx[oo][op],azn[oo][op];
int bmx[oo][op], bmn[oo][op];
int lg[oo];
int n,m,q;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin >> n >> m >> q;
for (int x,i=1;i<=n;i++){
cin >> x;
amx[i][0] = amn[i][0] = x;
afx[i][0] = (x < 0 ? x : mininf);
azn[i][0] = (x >= 0 ? x : maxinf);
}
for (int x,i=1;i<=m;i++){
cin >> x;
bmx[i][0] = bmn[i][0] = x;
}
for (int i=2;i<=max(n,m);i++)
lg[i] = lg[i >> 1] + 1;
for (int j=1;j<=lg[n];j++){
for (int i=1;i+(1<<j)-1<=n;i++){
int p = i + (1 << (j - 1));
amx[i][j] = jntm(amx[i][j-1],amx[p][j-1]);
afx[i][j] = jntm(afx[i][j-1],afx[p][j-1]);
amn[i][j] = ngm (amn[i][j-1],amn[p][j-1]);
azn[i][j] = ngm (azn[i][j-1],azn[p][j-1]);
}
}
for (int j=1;j<=lg[m];j++){
for (int i=1;i+(1<<j)-1<=m;i++){
int p = i + (1 << (j - 1));
bmx[i][j] = jntm(bmx[i][j-1],bmx[p][j-1]);
bmn[i][j] = ngm (bmn[i][j-1],bmn[p][j-1]);
}
}
while (q--) {
int la,ra,lb,rb;
cin>> la >> ra >> lb >> rb;
int sa = lg[ra - la + 1], sb = lg[rb - lb + 1];
int pa = ra - (1 << sa) + 1, pb = rb - (1 << sb) + 1;
int amax = jntm(amx[la][sa], amx[pa][sa]);
int amin = ngm (amn[la][sa], amn[pa][sa]);
int afmx = jntm(afx[la][sa], afx[pa][sa]);
int azmn = ngm (azn[la][sa], azn[pa][sa]);
int bmax = jntm(bmx[lb][sb], bmx[pb][sb]);
int bmin = ngm (bmn[lb][sb], bmn[pb][sb]);
int ans = mininf;
gmx(ans, amax * (amax >= 0 ? bmin : bmax));
gmx(ans, amin * (amin >= 0 ? bmin : bmax));
if (afmx != mininf)
gmx(ans, afmx * (afmx >= 0 ? bmin : bmax));
if (azmn != maxinf)
gmx(ans, azmn * (azmn >= 0 ? bmin : bmax));
printf("%lld\n", ans);
}
return 0;
}
P8819 CSP-S 2022 星战
//2024.3.27
//by white_ice
#include<bits/stdc++.h>
using namespace std;
#define itn long long
#define int long long
const int oo = 500005;
int r[oo],w[oo],g[oo];
itn n,m;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin >> n >> m ;
mt19937 rng(time(0));
for (itn i=1;i<=n;i++)
w[i] = rng();
int tar = accumulate(w+1,w+n+1,0LL);
int now = 0;
while (m--){
int u,v;
cin >> u >> v;
r[v] += w[u];
g[v] = r[v];
now += w[u];
}
int q;
cin >> q;
while (q--){
itn t;
cin >> t;
switch (t){
int u,v;
case 1:
cin >> u >> v;
r[v] -= w[u];
now -= w[u];
break;
case 2:
cin >> v;
now -= r[v];
r[v] = 0;
break;
case 3:
cin >> u >> v;
r[v] += w[u];
now += w[u];
break;
case 4:
cin >> v;
now += g[v]-r[v];
r[v] = g[v];
break;
}
cout << (now == tar?"YES":"NO")<<endl;
}
return 0;
}
果然人在家就会闲,(乐
mysqld --install
mysqld --initialize --console
mysql -u root -p
alter user 'root'@'localhost' identified by ''
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
netsh advfirewall firewall add rule name=sshd dir=in action=allow protocol=TCP localport=20
net start sshd
浅调了一下服务器。