最近感觉状态差极了
这种题要调40min……
UR水题不会做
以我3个月前的水平反而会了
感觉极其不爽,为什么有些人没有你努力竞赛照样比你搞得好那是因为这些人太假了,刷题都用小号给你造成不怎么刷题的假象(2016.3.10才发现……)
我觉得这和智商没什么关系
不说了,这是一个裸并查集
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n,f[300005],is[300005],stx[555]; struct Read{ int opt,v,ans; }read[100005]; int Find(int x){return x==f[x]?x:f[x]=Find(f[x]);} void Union(int sa,int sb){if(sa<sb)f[sa]=sb;else f[sb]=sa;} int main(){ freopen("4320.in","r",stdin); freopen("4320.out","w",stdout); scanf("%d",&n); memset(stx,127,sizeof(stx)); for(int i=1;i<=n;i++){ char s[10]; int val; scanf("%s %d",s,&val); read[i].opt=s[0]-'A'; read[i].v=val; if(read[i].opt==0){ for(int j=1;j<=550;j++)stx[j]=min(stx[j],val%j); is[val]=1; } else if(val<=550){ read[i].ans=stx[val]; } } f[300001]=300001; for(int i=300000;i>=1;i--){if(!is[i])f[i]=Find(f[i+1]);else f[i]=i;} for(int i=n;i>=1;i--){ if(read[i].opt==0){ Union(Find(read[i].v),Find(read[i].v+1)); } else if(read[i].v>550){ read[i].ans=2100000000; for(int j=0;j*read[i].v<=300000;j++){ read[i].ans=min(read[i].ans,(Find(read[i].v*j==0?1:read[i].v*j)==300001?read[i].v-1:Find(read[i].v*j==0?1:read[i].v*j))%read[i].v); } } } for(int i=1;i<=n;i++){ if(read[i].opt)printf("%d\n",read[i].ans); } return 0; }
Sep 05, 2022 12:56:23 PM
Rajasthan Board of Secondary Education (RBSE) Ajmer is Going to Conduct the Secondary (10th) Exam in month of March to April 2023 under Rajasthan State Government. RBSE is Published in Secondary Model Rajasthan 10th Question Paper Question Paper 2023 Blueprint at Official Website Rajasthan Board of Secondary Education (RBSE) Ajmer is Going to Conduct the Secondary (10th) Exam in month of March to April 2023 under Rajasthan State Government. RBSE is Published in Secondary Model Question Paper 2023 Blueprint at Official Website