标题
增加 1 行删除 1 行
1CSP-S 2025 JS 迷惑行为大赏1CSP-S 2025 JS 迷惑行为大赏(上+下)
正文
增加 1079 行删除 35 行
1234567876 行未改动8586878889909192937 行未改动101102103104105106107108109178 行未改动全部展开2882892902912922932942952968 行未改动30530630730830931031131231358 行未改动372373374375376377378379380110 行未改动全部展开491492493494495496497498499339 行未改动全部展开8398408418428438448458468477 行未改动855856857858859860861862210 行未改动全部展开1073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510968 行未改动1105110611071108110911101111111211131114111511161117111841 行未改动116011611162116311641165116611671168259 行未改动全部展开142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214532 行未改动14561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484225 行未改动全部展开17101711171217131714171517161717171855 行未改动177417751776177717781779178017811782155 行未改动全部展开格式学习自 [NOIP 2024 JS 迷惑行为大赏](https://www.luogu.com.cn/article/u7t1mnfk)。本次江苏共有 $1915$ 名选手参加了 CSP-S。**免责声明:以下代码不代表作者本人观点。**# 示例以下是一个代码展示格式的示例。76 行未改动:::info[[replace.cpp]**没骂人,求放过**]```cpp// O(q*B^2 + q*(S/2*B ... meimaren))// ccf qiufangguo// dayangli ruocheng shenme yangzi le aaaaaa....7 行未改动:::info[[replace.cpp]**如你所愿** (我承认说话有点大声了)]```cpp* os:希望数据也能这么水```:::178 行未改动全部展开:::## JS-S00206:::info[[club.cpp]**Clannad老师晚上好** 你怎么知道我2+1遐蝶了]```cpp//要开longlong,多测要清空//想上电视qwq8 行未改动## JS-S00213:::info[[club.cpp]**天梯大蛇**]画面过于暴力就不放了,大概就是写一行代码加一个tab,总共119行:::## JS-S00227 / JS-S0023358 行未改动#define y0 ak_noi#define y1 ak_noi```:::## JS-S00306:::info[[replace.cpp] **听我说谢谢你**]```cpp110 行未改动全部展开to leave home and get more hands-on experience."Zhong1 Guo3 was very glad to have a look at the outer part of the world, so she left the capital with a guide and three whole chests of gold coinshappily. She spent one chest of coins quickly in the first month. She decided to go home, but on the way home, the guide robbed all her money and escaped.The princess walked home tiredly and hungrily, surprised with the attitude of her friends before, when she is still rich. Hearing her story, the old kingsmiled and said, "This is the first class, people's attitude to you depends on the interest they can make from you."The princess left again with little money at the second time. She found a boyfriend and they loved each other deeply. But one day, she found thather boyfriend had another "only"! She was angry and went back home. "This is the second class, don't be the doll to love.", the old king said with acough.The princess travelled the third time. This time she brought some money and a pair o rings. She soon found her love, who was kind, thoughtful and339 行未改动全部展开:::## JS-S00456:::info[[club/road/replace/employ.cpp] **六条戒律哪够,来个 $93$ 条**]```cpp/*1. keep calm, one mistake can't ruin ur test, but mental breakdown can7 行未改动*/```:::--------------$1501\sim 1915$ author:[LuoFeng_Nanami](https://www.luogu.com.cn/user/759710)## JS-S01504210 行未改动全部展开int n;cin>>n;int a[n+5][4];for(inti=1;i<=n;i++){cin>>a[i][1]>>a[i][2]>>a[i][3] ; }intcnt[4]={0 },c[n+1],f[n+1];long long tot=0;for(int i=1;i<=n;i++){int m=max(a[i][1], max(a[i][2],a[i][3])); for(intj=1;j<=3;j++){if(a[i][j]==m)8 行未改动i][3]};sort(x,x+3); c[i]=x[2]-x[1];} /* for(inti=1;i<=n;i++){cout<<f[i]<<ppp;}cout<<endlpp>>>>>>*/for(int i=1;i<=3;i++){if(cnt[i]>n/2){int cn[cnt[i]+1];for(intj=1,k=1;j<=n;j++){if(f[j]==i){cn41 行未改动using namespace std;#define NetEase 998244353int main(){freopen("employ.in","r",stdin);freopen("employ.out","w",stdout);int miHoYo,SEGA;cin>>miHoYo>>SEGA;string SONY;cin>>SONY;259 行未改动全部展开int main(){// freopen("club.in","r"stdin);// freopen("club.out","w"stdout);cout<<"18"<<endl;cout<<"4"<<endl;cout<<"13"<<endl;return 0;}```[road.cpp]```cppint main(){// freopen("road.in","r"stdin);// freopen("road.out","w"stdout);cout<<"13"<<endl;return 0;}```2 行未改动int main(){// freopen("replace.in","r"stdin);// freopen("replace.out","w"stdout);cout<<"2"<<endl;cout<<"0"<<endl;return 0;}```[employ.cpp]```cppint main(){// freopen("employ.in","r"stdin);// freopen("employ.out","w"stdout);cout<<"2"<<endl;return 0;}```:::## JS-S01634:::info[[road.cpp] **想从 ccf 身上捞一笔?**]```cpp//csp kao chang yu dao zhe zhong qing kuan ccf huei chu duo shao qian```225 行未改动全部展开wo yao shang qi pa he ji!!!!!!!!!!! :(//freopen()//freopen()//freopen()//freopen()55 行未改动*/```:::## JS-S01747:::info[[club.cpp] 那很好了]```cpp//Oh my god! I can see the problem only on 14:39!```:::155 行未改动全部展开123456789101112131476 行未改动9192939495969798997 行未改动107108109110111112113114115178 行未改动全部展开2942952962972982993003013028 行未改动31131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944058 行未改动499500501502503504505506507110 行未改动全部展开618619620621622623624625626339 行未改动全部展开9669679689699709719729739747 行未改动9829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906210 行未改动全部展开2117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921408 行未改动2149215021512152215321542155215621572158215921602161216241 行未改动220422052206220722082209221022112212259 行未改动全部展开247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972 行未改动25002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528225 行未改动全部展开27542755275627572758275927602761276255 行未改动281828192820282128222823282428252826155 行未改动全部展开格式学习自 [NOIP 2024 JS 迷惑行为大赏](https://www.luogu.com.cn/article/u7t1mnfk)。本次江苏共有 $1915$ 名选手参加了 CSP-S,因为参赛选手较多,分为上(JS-S00001 至 JS-S00600)、中(JS-S00601 至 JS-S01500)、下(JS-S01501 至 JS-S01915)三部分,本篇专栏是上、下两部分合集,由 [liuhaodong947](https://www.luogu.com.cn/user/304613)、[\_qwerty\_](https://www.luogu.com.cn/user/905744)、[LuoFeng_Nanami](https://www.luogu.com.cn/user/759710) 共同完成。**限时活动(截止日期 2025/12/31):在评论区发送 `vote: 00000,...,01915`(五位数字是准考证号后五位)为你喜爱的选手迷惑行为投票!每人限量 $20$ 票,超出无效,以最后一条评论为准!**榜单见 [此处](https://www.luogu.me/paste/nyi42o7c)。欢迎各位继续投稿!**免责声明:以下代码不代表作者本人观点。**# 示例以下是一个代码展示格式的示例。76 行未改动:::info[[replace.cpp]**没骂人,求放过**]```cpp// O(q*B^2 + q*(S/2*B ... meimaren))// ccf qiufangguo// dayangli ruocheng shenme yangzi le aaaaaa....7 行未改动:::info[[replace.cpp]**如你所愿** (我承认说话有点大声了)]```cpp* os:希望数据也能这么水```:::178 行未改动全部展开:::## JS-S00206:::info[[club.cpp]**Clannad老师晚上好** ]```cpp//要开longlong,多测要清空//想上电视qwq8 行未改动## JS-S00213:::info[[club.cpp]**天梯大蛇**]**建议复制至本地观赏。**```cpp#include<bits/stdc++.h>using namespace std;bool cmp(int x,int y){return x>y;}int main(){freopen("club.in","r","std.in");freopen("club.out","w","std.out");long long t,n,a1[10005],a2[10005],a3[10005];cin>>t;int cnt;for (int i=1;i<=t;i++){cin>>n;int sum=0,sum1=0,sum2=0;int cnt=0;for (int j=1;j<=n;j++){cin>>a1[j]>>a2[j]>>a3[j];if (a1[j]>a2[j]&&a1[j]>a3[j]){sum++;cnt+=a1[j];} if (a2[j]>a1[j]&&a2[j]>a3[j]){sum1++;cnt+=a2[j];} if (a3[j]>a1[j]&&a3[j]>a2[j]){sum2++;cnt+=a3[j];}if (sum>(n/2)){sort(a2,a2+n,cmp);sort(a1,a1+n,cmp);sort(a3,a3+n,cmp);if (a2[j]>a3[j]){sum1++;cnt+=a2[j];}else {sum2++;cnt+=a3[j];}sum--;cnt-=a1[j];}if (sum>(n/2)){sort(a2,a2+n);sort(a1,a1+n);sort(a3,a3+n);if (a2[j]>a3[j]){sum1++;cnt+=a2[j];}else {sum2++;cnt+=a3[j];}sum--;cnt-=a1[j];}if (sum1>(n/2)){sort(a2,a2+n,cmp);sort(a1,a1+n,cmp);sort(a3,a3+n,cmp);if (a1[j]>a3[j]){sum++;cnt+=a1[j];}else {sum2++;cnt+=a3[j];}sum1--;cnt-=a2[j];} if (sum1>(n/2)){sort(a2,a2+n);sort(a1,a1+n);sort(a3,a3+n);if (a1[j]>a3[j]){sum++;cnt+=a1[j];}else {sum2++;cnt+=a3[j];}sum1--;cnt-=a2[j];}if(sum2>(n/2)){sort(a2,a2+n,cmp);sort(a1,a1+n,cmp);sort(a3,a3+n,cmp);if (a1[j]>a2[j]){cnt+=a1[j];}else {sum1++;cnt+=a2[j];}sum2--;cnt-=a3[j];}if(sum2>(n/2)){sort(a2,a2+n);sort(a1,a1+n);sort(a3,a3+n);if (a1[j]>a2[j]){sum++;cnt+=a1[j];}else {sum1++;cnt+=a2[j];}sum2--;cnt-=a3[j];}}if(cnt==10){cout<<"13"<<endl;}else {cout<<cnt<<endl;}}return 0;}```:::## JS-S00227 / JS-S0023358 行未改动#define y0 ak_noi#define y1 ak_noi```:::## JS-S00305:::info[[replace.cpp] **听我说谢谢你**]```cpp110 行未改动全部展开to leave home and get more hands-on experience."Zhong1 Guo3 was very glad to have a look at the outer part of the world, so she left the capital with a guide and three whole chests of gold coinshappily. She spent one chest of coins quickly in the first month. She decided to go home, but on the way home, the guide robbed all her money and escaped.The princess walked home tiredly and hungrily, surprised with the attitude of her friends before, when she is still rich. Hearing her story, the old kingsmiled and said, "This is the first class, people's attitude to you depends on the interest they can make from you."The princess left again with little money at the second time. She found a boyfriend and they loved each other deeply. But one day, she found thather boyfriend had another "only"! She was angry and went back home. "This is the second class, don't be the doll to love.", the old king said with acough.The princess travelled the third time. This time she brought some money and a pair o rings. She soon found her love, who was kind, thoughtful and339 行未改动全部展开:::## JS-S00456:::info[[club/road/replace/employ.cpp] 六条戒律哪够,来个 $93$ 条]```cpp/*1. keep calm, one mistake can't ruin ur test, but mental breakdown can7 行未改动*/```:::## JS-S00468:::info[[club.cpp] 密码锁这一块]```cppif(n == 2)for(int i = 1;i <= 3;i++)for(int j = 1;j <= 3;j++){if(i == j) continue;ans = max(a[1][i] + a[2][j],ans);}else if(n == 4)for(int i = 1;i <= 3;i++)for(int j = 1;j <= 3;j++)for(int k = 1;k <= 3;k++)for(int l = 1;l <= 3;l++){memset(x,0,sizeof x);x[i]++,x[j]++,x[k]++,x[l]++;if(x[1] > n / 2 || x[2] > n / 2 || x[3] > n / 2) continue;ans = max(ans,a[1][i] + a[2][j] + a[3][k] + a[4][l]);}else if(n == 10)for(int q = 1;q <= 3;q++)for(int w = 1;w <= 3;w++)for(int e = 1;e <= 3;e++)for(int r = 1;r <= 3;r++)for(int t = 1;t <= 3;t++)for(int yy = 1;yy <= 3;yy++)for(int u = 1;u <= 3;u++)for(int i = 1;i <= 3;i++)for(int o = 1;o <= 3;o++)for(int p = 1;p <= 3;p++){memset(x,0,sizeof x);x[q]++,x[w]++,x[e]++,x[r]++,x[t]++,x[yy]++,x[u]++,x[i]++,x[o]++,x[p]++;if(x[1] > n / 2 || x[2] > n / 2 || x[3] > n / 2) continue;ans = max(ans,a[1][q] + a[2][w] + a[3][e] + a[4][r] + a[5][t] + a[6][yy] + a[7][u] + a[8][i] + a[9][o] + a[10][p]);}```:::## JS-S00469:::info[[club/road/replace/employ.cpp] 膜拜来了]```cpp//mo bai xst dalao//mo bai wyx dalao//mo bai cyh dalao//I AK IOI//Ren5Jie4Di4Ling5%```:::## JS-S00479:::info[[club.cpp] ready for afo]```cpp//t2 zhale.//ready for afo.```:::## JS-S00493:::info[[club.cpp] 循环展开喜加一]```cppif(n==2){for(int i=1;i<=3;i++){cnt[i]++;sum+=a[1][i];for(int i2=1;i2<=3;i2++){cnt[i2]++;sum+=a[2][i2];if(judge(n) && maxn<sum){maxn=sum;}cnt[i2]--;sum-=a[2][i2];}cnt[i]--;sum-=a[1][i];}}else if(n==4){for(int i=1;i<=3;i++){cnt[i]++;sum+=a[1][i];for(int i2=1;i2<=3;i2++){cnt[i2]++;sum+=a[2][i2];for(int i3=1;i3<=3;i3++){cnt[i3]++;sum+=a[3][i3];for(int i4=1;i4<=3;i4++){cnt[i4]++;sum+=a[4][i4];if(judge(n) && maxn<sum){maxn=sum;}cnt[i4]--;sum-=a[4][i4];}cnt[i3]--;sum-=a[3][i3];}cnt[i2]--;sum-=a[2][i2];}cnt[i]--;sum-=a[1][i];}}else if(n==10){for(int i=1;i<=3;i++){cnt[i]++;sum+=a[1][i];for(int i2=1;i2<=3;i2++){cnt[i2]++;sum+=a[2][i2];for(int i3=1;i3<=3;i3++){cnt[i3]++;sum+=a[3][i3];for(int i4=1;i4<=3;i4++){cnt[i4]++;sum+=a[4][i4];for(int i5=1;i5<=3;i++){cnt[i5]++;sum+=a[5][i5];for(int i6=1;i6<=3;i6++){cnt[i6]++;sum+=a[6][i6];for(int i7=1;i7<=3;i7++){cnt[i7]++;sum+=a[7][i7];for(int i8=1;i8<=3;i8++){cnt[i8]++;sum+=a[8][i8];for(int i9=1;i9<=3;i9++){cnt[i9]++;sum+=a[9][i9];for(int ix=1;ix<=3;ix++){cnt[ix]++;sum+=a[10][ix];if(judge(n) && maxn<sum){maxn=sum;}cnt[ix]--;sum-=a[10][ix];}cnt[i9]--;sum-=a[9][i9];}cnt[i8]--;sum-=a[8][i8];}cnt[i7]--;sum-=a[7][i7];}cnt[i6]--;sum-=a[6][i6];}cnt[i5]--;sum-=a[5][i5];}cnt[i4]--;sum-=a[4][i4];}cnt[i3]--;sum-=a[3][i3];}cnt[i2]--;sum-=a[2][i2];}cnt[i]--;sum-=a[1][i];}}:::## JS-S00500:::info[[club.cpp] 给初赛 $98$ pts 的卡头了]```cpp//luogu914813 Undercraft//acta est fabula,plaudite//vivid/stasis//fu sai JS-J00492 JS-S00500//chu sai -j 98 -s 72//csp-s//xi wang neng jin noip//15:07 fa xian bu shi tan xin,zai xie fen zu bei bao```:::## JS-S00503:::info[[club.cpp] 密码锁+1]```cppif(n>10){if(cmp(n)){sort(a+1,a+n+1,cm);for(int i=1;i<=n/2;i++){ans+=a[i];}}else{cout<<1876432;}}else if(n==2){for(int i=1;i<=3;i++){for(int j=1;j<=3 && j!=i;j++){ans=max(ans,de(i,1)+de(j,2));}}}else if(n==4){for(int a=1;a<=3;a++){for(int b=1;b<=3;b++){for(int c=1;c<=3;c++){for(int d=1;d<=3;d++){df(a);df(b);df(c);df(d);if(k>n/2 || l>n/2 || m>n/2) continue;ans=max(ans,de(a,1)+de(b,2)+de(c,3)+de(d,4));}}}}}else{for(int a=1;a<=3;a++){for(int b=1;b<=3;b++){for(int c=1;c<=3;c++){for(int d=1;d<=3;d++){for(int e=1;e<=3;e++){for(int f=1;f<=3;f++){for(int g=1;g<=3;g++){for(int h=1;h<=3;h++){for(int i=1;i<=3;i++){for(int j=1;j<=3;j++){df(a);df(b);df(c);df(d);df(e);df(f);df(g);df(h);df(i);df(j);if(k>n/2 || l>n/2 || m>n/2) continue;ans=max(ans,de(a,1)+de(b,2)+de(c,3)+de(d,4)+de(e,5)+de(f,6)+de(g,7)+de(h,8)+de(i,9)+de(j,10));}}}}}}}}}}}```:::## JS-S00504:::info[[road.cpp] 卡常大师]看到回复一下,好奇过没过orz```cpp/*kkksc03 orz orz orz Orz Orz Orz Orz Orz Orz999ms 998ms*/```:::## JS-S00513:::info[[road.cpp] pdf大手子]**部分与原题面不符的为lg关键字屏蔽,与作者无关**```cpp/*2025 CCF 非专业级软件能力认证CSP-J/S 2025 第二轮认证提高级时间:2025 年 11 月 1 日 14:30 ∼ 18:30题目名称 社团招新 道路修复 谐音替换 员工招聘题目类型 传统型 传统型 传统型 传统型目录 club road replace employ可执行文件名 club road replace employ输入文件名 club.in road.in replace.in employ.in输出文件名 club.out road.out replace.out employ.out每个测试点时限 1.0 秒 1.0 秒 1.0 秒 1.0 秒内存限制 512 MiB 512 MiB 2048 MiB 512 MiB测试点数目 20 25 20 25测试点是否等分 是 是 是 是road.cpp replace.cpp employ.cpp提交源程序文件名对于 C++ 语言club.cpp编译选项对于 C++ 语言‐O2 ‐std=c++14 ‐static注. 意. 事. 项(. 请. 仔. 细. 阅. 读).1. 文件名(程序名和输入输出文件名)必须使用英文小写。2. main 函数的返回值类型必须是 int,程序正常结束时的返回值必须是 0。3. 若无特殊说明,结果的比较方式为全文比较(过滤行末空格及文末换行)。4. 选手提交的程序源文件大小不得超过 100 KiB。5. 提交的程序源文件的放置位置请参考各省的具体要求。6. 程序可使用的栈空间内存限制与题目的内存限制一致。7. 禁止在源代码中改变编译器参数(如使用 #pragma 命令),禁止使用系统结构相关指令(如内联汇编)或其他可能造成不公平的方法。8. 因违反上述规定而出现的问题,申诉时一律不予受理。9. 只提供 Linux 格式附加样例文件。10. 全国统一评测时采用的机器配置为:Intel Core Ultra 9 285K CPU @ 3.70 GHz(关闭睿频与能效核),内存 96 GB。上述时限以此配置为准。11. 评测在当前最新公布的 NOI Linux 下进行,各语言的编译器版本以此为准。2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证提高级 社团招新(club)社团招新(club)【题目描述】小 L 是学校算法协会的成员。在今年的学校社团招新中,小 L 一共招收了 n 个新成员,其中 n 为 偶L 希望将他们分到协会不同的部门。. 数。现在小.算法协会共设有三个部门,其中第 i (1 ≤ i ≤ n) 个新成员对第 j (1 ≤ j ≤ 3) 个部门的满意度为 a i,j 。定义一个分配方案的满意度为所有新成员对分配到的部门的满意度之和,也就是说,若将第 i (1 ≤ i ≤ n) 个新成员分配到了第 d i ∈ {1, 2, 3} 个部门,则该∑分配方案的满意度为 ni=1 a i,d i 。小 L 不希望某一个部门的新成员数量过多。具体地,他要求在分配方案中, 不. 存. 在.n一个部门被分配 多. 于. 2 个新成员。你需要帮助小 L 求出,满足他要求的分配方案的满意度的最大值。【输入格式】从文件 club.in 中读入数据。本. 题. 包. 含. 多. 组. 测. 试. 数. 据。.输入的第一行包含一个正整数 t,表示测试数据组数。接下来依次输入每组测试数据,对于每组测试数据:• 第一行包含一个正整数 n,表示新成员的数量。• 第 i + 1 (1 ≤ i ≤ n) 行包含三个非负整数 a i,1 , a i,2 , a i,3 ,分别表示第 i 个新成员对第 1, 2, 3 个部门的满意度。【输出格式】输出到文件 club.out 中。对于每组测试数据,输出一行一个非负整数,表示满足小 L 要求的分配方案的满意度的最大值。【样例 1 输入】1 32 43 4 2 14 3 2 45 5 3 46 3 5 17 4第 2 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证8 0 1 09 0 1 010 0 2 011 0 2 012 213 10 9 814 4 0 0提高级 社团招新(club)【样例 1 输出】1 182 43 13【样例 1 解释】该样例共包含三组测试数据。对于第一组测试数据,可以将四个新成员分别分配到第 1, 3, 1, 2 个部门,则三个部门的新成员数量分别为 2, 1, 1,均不超过42= 2,满意度为 4 + 4 + 5 + 5 = 18。对于第二组测试数据,可以将四个新成员分别分配到第 1, 1, 2, 2 个部门,则三个部门的新成员数量分别为 2, 2, 0,均不超过42= 2,满意度为 0 + 0 + 2 + 2 = 4。对于第三组测试数据,可以将两个新成员分别分配到第 2, 1 个部门,则三个部门的新成员数量分别为 1, 1, 0,均不超过22= 1,满意度为 9 + 4 = 13。【样例 2】见选手目录下的 club/club2.in 与 club/club2.ans。该样例满足测试点 3, 4 的约束条件。【样例 3】见选手目录下的 club/club3.in 与 club/club3.ans。该样例满足测试点 5 ∼ 8 的约束条件。【样例 4】见选手目录下的 club/club4.in 与 club/club4.ans。该样例满足测试点 9 的约束条件。第 3 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证提高级 社团招新(club)【样例 5】见选手目录下的 club/club5.in 与 club/club5.ans。该样例满足测试点 15, 16 的约束条件。【数据范围】对于所有测试数据,保证:• 1 ≤ t ≤ 5;• 2 ≤ n ≤ 10 5 ,且 n 为偶数;• 对于所有 1 ≤ i ≤ n,1 ≤ j ≤ 3,均有 0 ≤ a i,j ≤ 2 × 10 4 。测试点编号 n =1 22 43, 4 105 ∼ 8 30910, 11特殊性质20015, 16B无A1213, 14无10 517 ∼ 20BC无特殊性质 A:对于所有 1 ≤ i ≤ n,均有 a i,2 = a i,3 = 0。特殊性质 B:对于所有 1 ≤ i ≤ n,均有 a i,3 = 0。特殊性质 C:对于所有 1 ≤ i ≤ n,1 ≤ j ≤ 3,a i,j 均在 [0, 2 × 10 4 ] 中 独. 立. 均. 匀. 随. 机.生成。第 4 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证提高级 道路修复(road)道路修复(road)【题目描述】C 国的交通系统由 n 座城市与 m 条连接两座城市的双向道路构成,第 i (1 ≤ i ≤ m)条道路连接城市 u i 和 v i 。 任. 意. 两. 座. 城. 市. 都. 能. 通. 过. 若. 干. 条. 道. 路. 相. 互. 到. 达。.然而,近期由于一场大地震,所有 m 条道路都被破坏了,修复第 i (1 ≤ i ≤ m) 条道路的费用为 w i 。与此同时, C 国还有 k 个准备进行城市化改造的乡镇。对于第 j (1 ≤ j ≤ k)个乡镇, C 国对其进行城市化改造的费用为 c j 。在城市化改造完第 j (1 ≤ j ≤ k) 个乡镇后,可以在这个乡镇与原来的 n 座城市间建造若干条道路,其中在它与第 i (1 ≤ i ≤ n)座城市间建造一条道路的费用为 a j,i 。C 国可以在这 k 个乡镇中选择 任. 意. 多. 个进行城市.化改造,也可以不选择任何乡镇进行城市化改造。n 座城市两两连为尽快恢复城市间的交通,C 国政zheng府fu希望以最低的费用将 原. 有的.通,也即任意两座原有的城市都能通过若干条修复或新建造的道路相互到达。你需要帮助他们求出,将原有的 n 座城市两两连通的最小费用。【输入格式】从文件 road.in 中读入数据。输入的第一行包含三个非负整数 n, m, k,分别表示原有的城市数量、道路数量和准备进行城市化改造的乡镇数量。输入的第 i + 1 (1 ≤ i ≤ m) 行包含三个非负整数 u i , v i , w i ,表示第 i 条道路连接的两座城市与修复该道路的费用。输入的第 j + m + 1 (1 ≤ j ≤ k) 行包含 n + 1 个非负整数 c j , a j,1 , a j,2 , . . . , a j,n ,分别表示将第 j 个乡镇进行城市化改造的费用与在该乡镇与原有的城市间建造道路的费用。【输出格式】输出到文件 road.out 中。输出一行一个非负整数,表示将原有的 n 座城市两两连通的最小费用。【样例 1 输入】1 4 4 22 1 4 63 2 3 74 4 2 55 4 3 46 1 1 8 2 4第 5 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证7提高级 道路修复(road)100 1 3 2 4【样例 1 输出】113【样例 1 解释】C 国政zheng府fu可以选择修复第 3 条和第 4 条道路,然后将第 1 个乡镇进行城市化改造,并建造它与第 1, 3 座城市间的道路,总费用为 5 + 4 + 1 + 1 + 2 = 13。可以证明,不存在比 13 更小的费用能使原有的 4 座城市两两连通。【样例 2】见选手目录下的 road/road2.in 与 road/road2.ans。该样例满足测试点 11, 12 的约束条件。【样例 3】见选手目录下的 road/road3.in 与 road/road3.ans。该样例满足测试点 13, 14 的约束条件。【样例 4】见选手目录下的 road/road4.in 与 road/road4.ans。该样例满足测试点 15, 16 的约束条件。【数据范围】对于所有测试数据,保证:• 1 ≤ n ≤ 10 4 ,1 ≤ m ≤ 10 6 ,0 ≤ k ≤ 10;• 对于所有 1 ≤ i ≤ m,均有 1 ≤ u i , v i ≤ n,u i ̸ = v i 且 0 ≤ w i ≤ 10 9 ;• 对于所有 1 ≤ j ≤ k,均有 0 ≤ c j ≤ 10 9 ;• 对于所有 1 ≤ j ≤ k,1 ≤ i ≤ n,均有 0 ≤ a j,i ≤ 10 9 ;• 任意两座原有的城市都能通过若干条原有的道路相互到达。第 6 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证提高级 道路修复(road)测试点编号 n ≤ m ≤ k ≤ 特殊性质1 ∼ 4 10 4 10 6 0 无5, 67, 89, 1011, 12510 310 615, 1617, 1810421 ∼ 25无A无13, 1419, 20A10 510510A无A无特殊性质 A:对于所有 1 ≤ j ≤ k,均有 c j = 0 且均存在 1 ≤ i ≤ n 满足 a j,i = 0。第 7 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证提高级 谐音替换(replace)谐音替换(replace)【题目描述】小 W 是一名喜欢语言学的算法竞赛选手。在语言学中,谐音替换是指将原有的字词替换为读音相同或相近的字词。小 W 发现,谐音替换的过程可以用字符串来进行描述。具体地,小 W 将谐音替换定义为以下字符串问题:给定 n 个字符串二元组,第 i (1 ≤ i ≤ n) 个字符串二元组为 (s i,1 , s i,2 ),满足|s i,1 | = |s i,2 |,其中 |s| 表示字符串 s 的长度。对于字符串 s,定义 s 的 替. 换如下:.• 对于 s 的某个子串 y,若存在 1 ≤ i ≤ n 满足 y = s i,1 ,则将 y 替换为 y ′ = s i,2 。具体地,设 s = x + y + z,其中 x 和 z 可以为空,“+”表示字符串拼接,则 s的替换将得到字符串 s ′ = x + y ′ + z。t j,1 , t j,2 ,小 W 提出了 q 个问题,第 j (1 ≤ j ≤ m) 个问题会给定两个 不. 同的字符串.她想知道有多少种字符串 t j,1 的替换能够得到字符串 t j,2 。两种 s 的替换不同当且仅当子x, z 不同或 i 不同。你需要. 串. y 的. 位. 置. 不. 同. 或. 用. 于. 替. 换. 的. 二. 元. 组. (s i,1 , s i,2 ) 不. 同,即.回答小 W 提出的所有问题。【输入格式】从文件 replace.in 中读入数据。输入的第一行包含两个正整数 n, q,分别表示字符串二元组的数量和小 W 提出的问题的数量。输入的第 i + 1 (1 ≤ i ≤ n) 行包含两个字符串 s i,1 , s i,2 ,表示第 i 个字符串二元组。输入的第 j + n + 1 (1 ≤ j ≤ q) 行包含两个字符串 t j,1 , t j,2 ,表示小 W 提出的第 j个问题。【输出格式】输出到文件 replace.out 中。输出 q 行,其中第 j (1 ≤ j ≤ q) 行包含一个非负整数,表示替换后得到字符串 t j,2的字符串 t j,1 的替换的数量。【样例 1 输入】1 4 22 xabcx xadex3 ab cd4 bc de第 8 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证5 aa bb6 xabcx xadex7 aaaa bbbb提高级 谐音替换(replace)【样例 1 输出】1 22 0【样例 1 解释】对于小 W 的第一个询问,共有 2 种 t 1,1 的替换能够得到 t 1,2 :1. 令 x, z 均为空串,y = xabcx,i = 1,则 y ′ = xadex,替换后得到 xadex;2. 令 x = xa,y = bc,z = x,i = 3,则 y ′ = de,替换后得到 xadex。【样例 2 输入】1 3 42 a b3 b c4 c d5 aa bb6 aa b7 a c8 b a【样例 2 输出】1 02 03 04 0【样例 3】见选手目录下的 replace/replace3.in 与 replace/replace3.ans。该样例满足测试点 11, 12 的约束条件。第 9 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证提高级 谐音替换(replace)【样例 4】见选手目录下的 replace/replace4.in 与 replace/replace4.ans。该样例满足测试点 15, 16 的约束条件。【数据范围】设 L 1 =∑ ni=1 |s i,1 | + |s i,2 |,L 2 =∑ qj=1 |t j,1 |+ |t j,2 |。对于所有测试数据,保证:• 1 ≤ n, q ≤ 2 × 10 ;5• 2 ≤ L 1 , L 2 ≤ 5 × 10 6 ;• 对于所有 1 ≤ i ≤ n,s i,1 , s i,2 均仅包含小写英文字母,且 |s i,1 | = |s i,2 |;• 对于所有 1 ≤ j ≤ q,t j,1 , t j,2 均仅包含小写英文字母,且 t j,1 ̸ = t j,2 。测试点编号1, 23 ∼ 567, 8n, q ≤10210 310 4L 1 , L 2 ≤2002, 000无AB10 6AB9, 102 × 10 611, 1213, 14特殊性质2 × 10 5A5 × 1015, 16无617 ∼ 20B无特殊性质 A:q = 1。特殊性质 B:定义字符串 s 为 特s 仅包含字符 a 和 b,且. 别. 的,当且仅当字符串.字符 b 在 s 中出现 恰1 ≤ i ≤ n,s i,1 , s i,2 均为特别的,且对于所有. 好一次。对于所有.1 ≤ j ≤ q,t j,1 , t j,2 均为特别的。第 10 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证提高级 员工招聘(employ)员工招聘(employ)【题目描述】小 Z 和小 H 想要合伙开一家公司,共有 n 人前来应聘,编号为 1 ∼ n。小 Z 和小H 希望录用至少 m 人。小 H 是面试官,将在接下来 n 天每天面试一个人。小 Z 负责决定应聘人前来面试的顺序。具体地,小 Z 可以选择一个 1 ∼ n 的排列 p,然后在第 i (1 ≤ i ≤ n) 天通知编号为 p i 的人前来面试。小 H 准备了 n 套难度不一的面试题。由于 n 个前来应聘的人水平大致相同,因此对于同一套题,所有人的作答结果是一致的。具体地,第 i (1 ≤ i ≤ n) 天的面试题的难度为 s i ∈ {0, 1},其中 s i = 0 表示这套题的难度较高,没有人能够做出;s i = 1 表示这套题的难度较低,所有人均能做出。小 H 会根据面试者的作答结果决定是否录用,即如果面试者没有做出面试题,则会拒绝,否则会录用。然而,每个人的耐心都有一定的上限,如果在他面试之前未录用的人数过多,则他会直接放弃参加面试。具体地,编号为 i (1 ≤ i ≤ n) 的人的耐心上限可以用非负整数 c i描述,若在他之前已经有 不. 少. 于. c i 人被拒绝或放弃参加面试,则他也将放弃参加面试。小 Z 想知道一共有多少种面试的顺序 p 能够让他们录用至少 m 人。你需要帮助小Z 求出,能够录用至少 m 人的排列 p 的数量。由于答案可能较大,你只需要求出答案对 998, 244, 353 取模后的结果。【输入格式】从文件 employ.in 中读入数据。输入的第一行包含两个正整数 n, m,分别表示前来应聘的人数和希望录用的人数。输入的第二行包含一个长度为 n 的字符串 s 1 . . . s n ,表示每一天的面试题的难度。输入的第三行包含 n 个非负整数 c 1 , c 2 , . . . , c n ,表示每个人的耐心上限。【输出格式】输出到文件 employ.out 中。输出一行一个非负整数,表示能够录用至少 m 人的排列 p 的数量对 998, 244, 353取模后的结果。【样例 1 输入】1 3 22 1013 1 1 2第 11 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证提高级 员工招聘(employ)【样例 1 输出】12【样例 1 解释】共有以下 2 种面试的顺序 p 能够让小 Z 和小 H 录用至少 2 人:1. p = [1, 2, 3],依次录用编号为 1 的人和编号为 3 的人;2. p = [2, 1, 3],依次录用编号为 2 的人和编号为 3 的人。【样例 2 输入】1 10 52 11011110113 6 0 4 2 1 2 5 4 3 3【样例 2 输出】12204128【样例 3】见选手目录下的 employ/employ3.in 与 employ/employ3.ans。该样例满足测试点 6 ∼ 8 的约束条件。【样例 4】见选手目录下的 employ/employ4.in 与 employ/employ4.ans。该样例满足测试点 12 ∼ 14 的约束条件。【样例 5】见选手目录下的 employ/employ5.in 与 employ/employ5.ans。该样例满足测试点 18 ∼ 21 的约束条件。第 12 页共 13 页2025 CCF 非专业级软件能力认证 CSP-J/S 2025 第二轮认证提高级 员工招聘(employ)【数据范围】对于所有测试数据,保证:• 1 ≤ m ≤ n ≤ 500;• 对于所有 1 ≤ i ≤ n,均有 s i ∈ {0, 1};• 对于所有 1 ≤ i ≤ n,均有 0 ≤ c i ≤ n。测试点编号 n ≤1, 2 103 ∼ 5 186 ∼ 8 29 ∼ 1110m无≤ n12 ∼ 14 =115 = n16, 17特殊性质无A50018 ∼ 21A≤ n22 ∼ 25B无特殊性质 A:对于所有 1 ≤ i ≤ n,均有 s i = 1。特殊性质 B:在 s 1 , s 2 , . . . , s n 中最多只有 18 个取值为 1,即第 13 页共 13 页∑ ni=1s i ≤ 18。*/```:::## JS-S00515:::info[[club.cpp] 密码锁再加一]```cppif(n==2){for(int i=1;i<=3;i++){for(int j=1;j<=3;j++){if(j!=i)ans=max(ans,a[1][i]+a[2][j]);}}cout<<ans<<endl;}else if(n==4){for(int i=1;i<=3;i++){for(int j=1;j<=3;j++){for(int k=1;k<=3;k++){for(int k1=1;k1<=3;k1++){if((i==j&&j==k)||(i==j&&j==k1)||(i==k&&k==k1)||(j==k&&k==k1))continue;ans=max(ans,a[1][i]+a[2][j]+a[3][k]+a[4][k1]);}}}}cout<<ans<<endl;}else{vector<int>b(n+1,0);for(int i=1;i<=n;i++)b[i]=a[i][1];sort(b.begin()+1,b.end(),cmp);cout<<b[1]+b[2]<<endl;}```:::## JS-S00516:::info[[club.cpp] 默哀]```cppfreopen("club2.in", "r", stdin);```:::## JS-S00518:::info[[road.cpp] saki,移动]```cppint main(){freopen("road.in","r",stdin);freopen("road.out","w",stdout);cout<<10086<<endl;return 0;}```:::## JS-S00522:::info[[club/employ/replace.cpp] woc,铁]```cpp//AD ASTRA PER ASPERA//i wanna ak``````cpp/*It's not easy so we should think it twice.We get the different part of each pair of (S1,S2) and (T1,T2)if a pair of (S1,S2) is the same we should ignore itThus, a pair of (T1,T2) can only match the pairs of (S1,S2) with the same difference of it.We hash the difference and put pairs into buckets by their difference.Insert the prefixes and suffixes into trie.3h could be enough for me, so I can get 300+.*/``````cpp//What's meant by miracle, a word outside my days?```:::## JS-S00593:::info[[employ.cpp] 焗雪梨好吃吗(&&@[wmyr](luogu://user/616733) is pretty]```cpp//ksmksmksmksmksmksm/*bu hui ying yu , jiu yong pin yin ba.ke neng shi zui hou yi ci csp le,noip 2025 rp++;wmyr is pretty.2025.11.01 17:30freopen("employ1.in","r",stdin);wei da de hyzx , chu le shi tang nan chi dao bao.zhe li ying gai you yi ge ju xue li biao qing bao zhi lei de ^(=w=^)~ , dan shi xian ran sai chang shang mei you zhe wan yi.*/```你要的,补上。:::--------------$1501\sim 1915$ author:[LuoFeng_Nanami](https://www.luogu.com.cn/user/759710)## JS-S01504210 行未改动全部展开int n;cin>>n;int a[n+5][4];for(inti=1;i<=n;i++){cin>>a[i][1]>>a[i][2]>>a[i][3] ; }intcnt[4]={0 },c[n+1],f[n+1];long long tot=0;for(int i=1;i<=n;i++){int m=max(a[i][1], max(a[i][2],a[i][3])); for(intj=1;j<=3;j++){if(a[i][j]==m)8 行未改动i][3]};sort(x,x+3); c[i]=x[2]-x[1];} /* for(inti=1;i<=n;i++){cout<<f[i]<<ppp;}cout<<endlpp>>>>>>*/for(int i=1;i<=3;i++){if(cnt[i]>n/2){int cn[cnt[i]+1];for(intj=1,k=1;j<=n;j++){if(f[j]==i){cn41 行未改动using namespace std;#define NetEase 998244353int main(){freopen("employ.in","r",stdin);freopen("employ.out","w",stdout);int miHoYo,SEGA;cin>>miHoYo>>SEGA;string SONY;cin>>SONY;259 行未改动全部展开int main(){// freopen("club.in","r"stdin);// freopen("club.out","w"stdout);cout<<"18"<<endl;cout<<"4"<<endl;cout<<"13"<<endl;return 0;}```[road.cpp]```cppint main(){// freopen("road.in","r"stdin);// freopen("road.out","w"stdout);cout<<"13"<<endl;return 0;}```2 行未改动int main(){// freopen("replace.in","r"stdin);// freopen("replace.out","w"stdout);cout<<"2"<<endl;cout<<"0"<<endl;return 0;}```[employ.cpp]```cppint main(){// freopen("employ.in","r"stdin);// freopen("employ.out","w"stdout);cout<<"2"<<endl;return 0;}```:::## JS-S01634:::info[[road.cpp] **想从 ccf 身上捞一笔?**]```cpp//csp kao chang yu dao zhe zhong qing kuan ccf huei chu duo shao qian```225 行未改动全部展开wo yao shang qi pa he ji!!!!!!!!!!! :(//freopen()//freopen()//freopen()//freopen()55 行未改动*/```:::## JS-S01747:::info[[club.cpp] 考场稳定发挥,那很好了]```cpp//Oh my god! I can see the problem only on 14:39!```:::155 行未改动全部展开