我去,吓死了,果然是万圣节。、
Day -5 ~ -1
Phigros!彩 48 咋也推不动直接放弃。ds 只能打到 S 崩溃了。17.10 -> 17.12。
Arcaea!没打。
复习了一些板子,不包括:数学,Floyd 的循环顺序。
孬!本市初中生不能去秦皇岛旅游,还面积不到别人,不能住酒店打音游,真的是太难受了(青默音)。
Day 0
晚上没睡多早,极度害怕挂分,做噩梦。
Day 1-1
J 重点不多,可省略不看。
JJJJJJJJJJ
早上带了一车吃的,进场前走了一大段路差点被冻成啥子。
Trick||Treat!
- 开 T1,太水了,看我直接炫技,
getline读入字符串然后直接sscanf拆掉,帅不帅。 - 开 T2,我去不简单。想了一会发现把最终长串双指针一下,从两边向中间找变化点,找的话存一下排序再用
lower_bound。(这是 jt2 吗我是不是又写繁了) - 开 T3,我去直接拆位。容易发现从高往低选,遍历位的时候维护之前高位的答案,一点一点缩小范围。(话说我为啥用双指针缩啊,是不是叒写繁了)
- 开 T4,我去感觉像 dp,不会啊。诶他好像有依赖递进关系,(前几天刚复习图论建模)诶建个图。诶呦我去是颗树,我去,大样例过了,?我去我 ak 了?
东西吃完了,好饿饿好饿饿好饿饿好饿饿
开始排查低级错误,以及 T3 拍子,都没问题。饿了 1h 出场。
出场面积:@stem12345xi 不会 t4,@Ma_Zeshu,@lichenxi123 可爱,@caiyuchen1 也 ak 了,这么拜谢。
Day 1-1.5
和某神秘 找bug 老师走路去吃饭,真的是太难吃了。糖醋里脊没有里脊变成糖醋土豆,并且糖醋体积 = 3x 土豆体积。幸好善良的 找bug 给我买了份奶茶,真的是太舒服了。
2:00 面积了大神 @int4399 和啥子 @Momo_Saiba 并由某机构合影。极度紧张 t2 切不掉。
Day 1-2
想省流的重点看粗体部分。
SSSSSSSSSS
Oct31==Dec25? 我绷住了。怎么 ccf 也会玩梗了。
我去!左面竟是机房里的冯狗(@FengSiYuan1)!
- 开 T1,哇敲咋这么简单,都没去年 T1 难,一个无脑二分答案做完了。
- 开 T2,好难读,站台地铁站地铁口地铁线绕死了急需形式化题意。理解题意和思考的方式十分大众化直接跳过。Floyd 写的 ijk 并且 k 是中转点并且只跑了一遍。测大样例与拍子的 200 组随机数据全部通过。 蛙趣有 200pts 了,舒服了。
- 开 T3,
Exoplanetary Migrate!最短路?dp?(注意我这个啥子并没有意识到直接硬跑最短路模拟题面有 24pts)不太会啊,推不出来啊,手玩无果,思考 40pts 无果,思考特殊 ABC 只会 A,8pts 跑路。 - 开 T4,妈呀疑似图论 ds,手玩无果,特殊 A 会了,10pts。
好饿饿好饿饿好饿饿好饿饿,剩余 1.5h 想 T3 T4 的不知道什么的部分分,总之全是无效思考,绕了 1.5h 的圈子,我是堂碧。最后 20min 紧急敲 T4 暴力 15pts 然后检查文件问题跑路。估 100+100+8+25。以为打满了实则 T3 唐分 24 没拿,气气气。
出场面积:@stem12345xi 竟然会 t2 这么拜谢,@int4399 260+ 拜谢,@lichenxi123 可爱,@caiyuchen1 会 t3 40pts 拜谢,@Momo_Saiba 啥子。
Day 1-3
晚上去闺蜜家蹭火锅子吃太棒啦!打了会音游,聊了会小说,分享学校cp 发展状况 一些有趣的事。
回家后打音游,并且看到 Melo 的美味女装。
Day 2
我草我 Floyd ijk 了,听到这个消息的时候大脑一片空白。T2 喜提 rand pts 呜哇。Day 2~5 心情无比低落,几乎每天晚上都在哭,真的想死了。
Day 6
我去,js 一丝不挂,T2 ijk 满了,hyw?还我 4 天眼泪!
悬着的心竟然没死,吓哭了,果然是万圣节。
后记
让我看看谁没有打开蓝框看全部游记喵!一点也不珍惜我的劳动成果喵!你怎么这么坏喵!捅死你喵!捅死你喵!捅死你喵!捅死你喵!捅死你喵!捅死你喵!捅死你喵!捅死你喵!
代码回头出了放一下呀。
代码
HE rk 26 全国 rk 2550 完了呀,T3 暴力忘打痛失 7 勾 /ll
J
travel(含神秘内容)
/*
AKed !!!!!!!!!!!!!!!!!!!! AKed AKed AKed AKed AKed AKed AKed AKed
luogu uid: elainya_stars
%%%%%%%%stostostosto SISIEF CSP-J orzorzorzorz%%%%%%%%
8:30 - 8:50 T1 passed
8:50 - 9:30 T2 passed
9:30 - 10:30 T3 passed
10:30 - 11:00 T4 passed
11:00 - 11:40 dui pai all passed
YESSSSSSSSSSSSSSSSSSSSSS
dont gua fen pls i beggggg uuuuu
dont gua fen pls i beggggg uuuuu
dont gua fen pls i beggggg uuuuu
let my luck continue to the CSP-S afternoon plssssssssssssssssssssss
if so, SISIEF ill never hate u againnnnnnnnnnnnn
PLS PLS PLS PLS PLS PLS PLS PLS PLS PLS PLS PLS PLS PLS PLS PLS
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int inf=0x3f3f3f3f3f3f3f3f;
string _inp;
char inp[30];
int a1,r1,a2,r2;char c1,c2;
signed main()
{
// fastio;
freopen("travel.in","r",stdin);
freopen("travel.out","w",stdout);
getline(cin,_inp);int _siz=_inp.size();
for(int i=0;i<_siz;i++) inp[i]=_inp[i];
sscanf(inp,"%lld %lld%c %lld %lld%c",&a1,&r1,&c1,&a2,&r2,&c2);
int ans1=0,ans2=0,ans3=0,ans4=0;
if(a1==a2)
{
ans1=1;
if(r1==r2)
{
ans2=1;
if((c1<='C' && c2<='C') || (c1>='D' && c2>='D'))
{
ans3=1;
if(c1-1==c2 || c2-1==c1 ||
(c1=='D' && c2=='F') || (c1=='F' && c2=='D'))
ans4=1;
}
}
}
return cout<<ans1<<ans2<<ans3<<ans4<<'\n',0;
}string
// AKed !!!!!!!!!!!!!!!!!!!! AKed AKed AKed AKed AKed AKed AKed AKed
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int inf=0x3f3f3f3f3f3f3f3f;
const int N=2e5+5;
struct input{int a;char c;}a[N];
int n,tot,mid,p[N*2],np,t[N],ans;
map<int,char> ml,mr;
char cl[N*2],cr[N*2];
signed main()
{
fastio;
freopen("string.in","r",stdin);
freopen("string.out","w",stdout);
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i].a>>a[i].c,tot+=a[i].a;
mid=tot/2;
int nowl=0,nowr=0;
for(int i=1;i<=n;i++)
{
nowl=nowr+1;nowr=nowl+a[i].a-1;
if(tot%2)
{
if(nowl<=mid+1) p[++np]=nowl;
if(nowr>=mid+1) p[++np]=tot-nowr+1;
}
else
{
if(nowl<=mid) p[++np]=nowl;
if(nowr>mid) p[++np]=tot-nowr+1;
}
t[i]=nowl;
}
if(tot%2) p[++np]=tot/2+2;
else p[++np]=tot/2+1;
sort(p+1,p+np+1);
np=unique(p+1,p+np+1)-p-1;
// for(int i=1;i<=np;i++) cout<<p[i]<<' ';cout<<'\n';
for(int i=1;i<np;i++)
{
int ix=upper_bound(t+1,t+n+1,p[i])-t-1;cl[i]=a[ix].c;
ix=upper_bound(t+1,t+n+1,tot-p[i]+1)-t-1;cr[i]=a[ix].c;
}
// for(int i=1;i<np;i++) cout<<cl[i]<<' '<<cr[i]<<'\n';
for(int i=1;i<np;i++)
if(cl[i]!=cr[i]) ans+=p[i+1]-p[i];
return cout<<ans<<'\n',0;
}
/*
3
2 a
2 b
1 c
2
2 a
3 a
6
1000000000 a
1000000000 a
1000000000 a
1000000000 b
1000000000 b
1000000000 b
*/and
// AKed !!!!!!!!!!!!!!!!!!!! AKed AKed AKed AKed AKed AKed AKed AKed
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
inline int read()
{
char c=getchar();int f=1,x=0;
while(c<'0' || c>'9') {(c=='-')?(f=-1):0;c=getchar();}
while(c>='0' && c<='9') {x=x*10+(c-'0');c=getchar();}
return x*f;
}
const int inf=0x3f3f3f3f3f3f3f3f;
const int N=2e5+5,S=31;
int n,m,a[N],ans;
int v[N],nv;
int tmp[N],nt;
int now[N],nn;
signed main()
{
fastio;
freopen("and.in","r",stdin);
freopen("and.out","w",stdout);
n=read(),m=read();
for(int i=1;i<=n;i++) a[i]=read();
if(m==1)
{
for(int i=1;i<=n;i++) ans=max(ans,a[i]);
return cout<<ans<<'\n',0;
}
for(int j=S;j>=0;j--)
{
nv=0;
for(int i=1;i<=n;i++)
if(a[i]&(1ll<<j)) v[++nv]=i;
if(nv==m && nn==0)
{
for(int i=2;i<=nv;i++) (i==2)?(ans=(a[v[i]]&a[v[i-1]])):(ans&=a[v[i]]);
return cout<<ans<<'\n',0;
}
else if(nv>=m)
{
if(nn==0) {for(int i=1;i<=nv;i++) now[++nn]=v[i];}
else
{
nt=0;
for(int i=1,j=1;i<=nn&&j<=nv;)
{
if(now[i]<v[j]) i++;
if(v[j]<now[i]) j++;
if(now[i]==v[j]) tmp[++nt]=now[i],i++,j++;
}
if(nt==m)
{
for(int i=2;i<=nt;i++) (i==2)?(ans=(a[tmp[i]]&a[tmp[i-1]])):(ans&=a[tmp[i]]);
return cout<<ans<<'\n',0;
}
else if(nt>m) {nn=0;for(int i=1;i<=nt;i++) now[++nn]=tmp[i];}
}
}
// for(int i=1;i<=nv;i++) cout<<v[i]<<' ';cout<<'\n';
// for(int i=1;i<=nn;i++) cout<<now[i]<<' ';cout<<"\n\n";
}
for(int i=2;i<=m;i++) (i==2)?(ans=(a[now[i]]&a[now[i-1]])):(ans&=a[now[i]]);
return cout<<ans<<'\n',0;
}
/*
4 2
3 15 12 12
5 3
31 3 1 15 7
*/card
// AKed !!!!!!!!!!!!!!!!!!!! AKed AKed AKed AKed AKed AKed AKed AKed
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
inline int read()
{
char c=getchar();int f=1,x=0;
while(c<'0' || c>'9') {(c=='-')?(f=-1):0;c=getchar();}
while(c>='0' && c<='9') {x=x*10+(c-'0');c=getchar();}
return x*f;
}
const int inf=0x3f3f3f3f3f3f3f3f;
const int N=5e5+5,M=3e5+5;
int n,m,a[N],freq[M];
int to[M],din[M],vis[M];
vector<int> fr[M];
queue<int> q;
signed main()
{
fastio;
freopen("card.in","r",stdin);
freopen("card.out","w",stdout);
n=read(),m=read();
for(int i=1;i<=n;i++) a[i]=read(),freq[a[i]]++;
a[n+1]=m+1;
for(int i=n;i>0;i--)
if(!to[a[i]])
{
to[a[i]]=a[i+1];
fr[a[i+1]].push_back(a[i]);
din[a[i+1]]++;
}
// for(int i=1;i<=m;i++)
// {
// cout<<to[i]<<' '<<din[i]<<'\n';
// for(auto j:fr[i]) cout<<j<<' ';
// cout<<"\n\n";
// }
for(int i=1;i<=m;i++)
if(!din[i]) q.push(i);
while(!q.empty())
{
int x=q.front();q.pop();
for(auto i:fr[x]) freq[x]+=freq[i];
if(--din[to[x]]==0)
q.push(to[x]);
}
for(int i=1;i<=m;i++) cout<<freq[i]<<' ';
return cout<<'\n',0;
}
/*
4 3
1 2 1 3
10 3
3 1 2 1 3 2 3 1 2 1
*/S
crystal
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
inline int read()
{
char c=getchar();int f=1,x=0;
while(c<'0' || c>'9') {(c=='-')?(f=-1):0;c=getchar();}
while(c>='0' && c<='9') {x=x*10+(c-'0');c=getchar();}
return x*f;
}
const int inf=0x3f3f3f3f3f3f3f3f;
const int N=5e5+5;
int n,m,a[N],pre[N];
bool check(int x)
{
for(int i=1;i+x-1<=n;i++)
if(a[i+x-1]*x-(pre[i+x-1]-pre[i-1])<=m) return 1;
return 0;
}
signed main()
{
fastio;
freopen("crystal.in","r",stdin);
freopen("crystal.out","w",stdout);
n=read(),m=read();for(int i=1;i<=n;i++) a[i]=read();
sort(a+1,a+n+1);
for(int i=1;i<=n;i++) pre[i]=pre[i-1]+a[i];
int l=0,r=n,mid,ans;
while(l<=r)
{
mid=(l+r)>>1;
if(check(mid)) ans=mid,l=mid+1;
else r=mid-1;
}
return cout<<ans<<'\n',0;
}
/*
5 5
1 2 4 8 9
5 8
-3 -1 2 2 7
*/subway
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define min(x,y) (x<y)?x:y
inline int read()
{
char c=getchar();int f=1,x=0;
while(c<'0' || c>'9') {(c=='-')?(f=-1):0;c=getchar();}
while(c>='0' && c<='9') {x=x*10+(c-'0');c=getchar();}
return x*f;
}
const ll inf=0x3f3f3f3f3f3f3f3f;
const int N=505,M=5e5+5,Q=1e5+5,D=25;
int _C_,n,m,d,q,w[M];
ll dis[N][N];
struct IN{int i,n;};
vector<IN> v[M];
signed main()
{
fastio;
freopen("subway.in","r",stdin);
freopen("subway.out","w",stdout);
_C_=read(),n=read(),m=read(),d=read(),q=read();
// cin>>_C_>>n>>m>>d>>q;
for(int i=1;i<=m;i++)
w[i]=read();
// cin>>w[i];
for(int i=1;i<=n;i++)
{
int k=read();
// int k;cin>>k;
for(int j=1;j<=k;j++)
{
int a=read(),t=read();
// int a,t;cin>>a>>t;
v[a].push_back({i,t});
}
}
memset(dis,0x3f,sizeof(dis));
for(int i=1;i<=n;i++) dis[i][i]=0;
for(int i=1;i<=m;i++)
{
int len=v[i].size();
if(len<=1) continue;
for(int j=0;j<len;j++)
for(int k=j+1;k<len;k++)
{
IN jj=v[i][j],kk=v[i][k];
dis[jj.i][kk.i]=dis[kk.i][jj.i]=
min(dis[jj.i][kk.i],(ll)(jj.n+kk.n));
}
}
// for(int i=1;i<=n;i++)
// {for(int j=1;j<=n;j++) cout<<dis[i][j]<<' ';cout<<'\n';}
// cout<<'\n';
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)if(i!=j)
for(int k=1;k<=n;k++)if(k!=i && j!=k)
dis[k][j]=min(dis[k][j],dis[i][k]+dis[i][j]);
// for(int i=1;i<=n;i++)
// {for(int j=1;j<=n;j++) cout<<dis[i][j]<<' ';cout<<'\n';}
while(q--)
{
int l=read(),r=read();
// int l,r;cin>>l>>r;
ll ans=inf,lenl=v[l].size(),lenr=v[r].size();
for(int i=0;i<lenl;i++)for(int j=0;j<lenr;j++)
{
IN ii=v[l][i],jj=v[r][j];
ans=min(ans,dis[ii.i][jj.i]+ii.n+jj.n);
}
ans+=w[l]+w[r];
cout<<ans<<'\n';
}
return 0;
}
/*
0 2 5 20 2
4 1 9 2 5
3 1 5 2 7 4 6
3 2 3 3 4 5 7
1 3
1 2
0 3 7 20 2
8 3 6 1 7 2 9
3 1 4 2 5 5 100
3 2 6 3 1 7 2
4 3 2 5 100 4 6 6 7
1 6
2 3
*/migrate(含神秘内容)
/*
T3T4 so difficult oh my goshhhhhhhhhh
or im just noob and nerd so i dont know how to do T3
just stop playing zorr before noip.
uhhhhhhhh im so useless.
100 + 100? + 8 + 25
im asking my self if my T1 will boom omggg
//freopen
// freopen
shitt
hate u again SISIEF
im NERD NOOOOOOOOOOOOOOOBBBBBBBBBBBBBB
there's absolute a bunch of 300+s in my school.
feels so bad
agykakgydadykggifeiwarkgyewkyakdfvsdylvliasldgfilagewriagler
luogu uid: elainya_stars
Gino and Geopelia 99999999999999999999
phigros rks 17.11
NOOOOOOOOOOOOOOOOOOBBBBBBBBBBB
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
inline int read()
{
char c=getchar();int f=1,x=0;
while(c<'0' || c>'9') {(c=='-')?(f=-1):0;c=getchar();}
while(c>='0' && c<='9') {x=x*10+(c-'0');c=getchar();}
return x*f;
}
const int inf=0x3f3f3f3f3f3f3f3f;
const int N=2e6+5;
int _C_,T,n,m,a[N];
void doAA()
{
if(n<=2) {cout<<"0\n";return ;}
int dif=a[2]-a[1];
int p=m/dif*2;
if(p<4) {cout<<"0\n";return ;}
cout<<max(0ll,n-p+1)<<'\n';
}
signed main()
{
fastio;
freopen("migrate.in","r",stdin);
freopen("migrate.out","w",stdout);
_C_=read(),T=read();
while(T--)
{
n=read(),m=read();
bool AA=1;
for(int i=1;i<=n;i++)
{
a[i]=read();
if(i>2 && a[i]-a[i-1]!=a[i-1]-a[i-2]) AA=0;
}
if(AA) {doAA();continue;}
cout<<"0\n";
}
return 0;
}hub
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define min(x,y) (x<y)?x:y
inline int read()
{
char c=getchar();int f=1,x=0;
while(c<'0' || c>'9') {(c=='-')?(f=-1):0;c=getchar();}
while(c>='0' && c<='9') {x=x*10+(c-'0');c=getchar();}
return x*f;
}
const ll inf=0x3f3f3f3f3f3f3f3f;
const int N=505,M=5e5+5,Q=1e5+5,D=25;
int _C_,n,m,d,q,w[M];
ll dis[N][N];
struct IN{int i,n;};
vector<IN> v[M];
signed main()
{
fastio;
freopen("subway.in","r",stdin);
freopen("subway.out","w",stdout);
_C_=read(),n=read(),m=read(),d=read(),q=read();
// cin>>_C_>>n>>m>>d>>q;
for(int i=1;i<=m;i++)
w[i]=read();
// cin>>w[i];
for(int i=1;i<=n;i++)
{
int k=read();
// int k;cin>>k;
for(int j=1;j<=k;j++)
{
int a=read(),t=read();
// int a,t;cin>>a>>t;
v[a].push_back({i,t});
}
}
memset(dis,0x3f,sizeof(dis));
for(int i=1;i<=n;i++) dis[i][i]=0;
for(int i=1;i<=m;i++)
{
int len=v[i].size();
if(len<=1) continue;
for(int j=0;j<len;j++)
for(int k=j+1;k<len;k++)
{
IN jj=v[i][j],kk=v[i][k];
dis[jj.i][kk.i]=dis[kk.i][jj.i]=
min(dis[jj.i][kk.i],(ll)(jj.n+kk.n));
}
}
// for(int i=1;i<=n;i++)
// {for(int j=1;j<=n;j++) cout<<dis[i][j]<<' ';cout<<'\n';}
// cout<<'\n';
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)if(i!=j)
for(int k=1;k<=n;k++)if(k!=i && j!=k)
dis[k][j]=min(dis[k][j],dis[i][k]+dis[i][j]);
// for(int i=1;i<=n;i++)
// {for(int j=1;j<=n;j++) cout<<dis[i][j]<<' ';cout<<'\n';}
while(q--)
{
int l=read(),r=read();
// int l,r;cin>>l>>r;
ll ans=inf,lenl=v[l].size(),lenr=v[r].size();
for(int i=0;i<lenl;i++)for(int j=0;j<lenr;j++)
{
IN ii=v[l][i],jj=v[r][j];
ans=min(ans,dis[ii.i][jj.i]+ii.n+jj.n);
}
ans+=w[l]+w[r];
cout<<ans<<'\n';
}
return 0;
}
/*
0 2 5 20 2
4 1 9 2 5
3 1 5 2 7 4 6
3 2 3 3 4 5 7
1 3
1 2
0 3 7 20 2
8 3 6 1 7 2 9
3 1 4 2 5 5 100
3 2 6 3 1 7 2
4 3 2 5 100 4 6 6 7
1 6
2 3
*/