版本比较
P15196 [SWERC 2018] City of Lights 题解
标题
增加 1 行删除 1 行
11《三体》解读P15196 [SWERC 2018] City of Lights 题解正文
增加 58 行删除 10 行
1234567891012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758# 作者# # # # # # # # #模拟开关过程,开一盏灯则熄灭数减一,否则加一,累加每次操作后的最大值即可。:::success[AC Code]```cpp#include<bits/stdc++.h>#define ull unsigned long long#define ll long longusing namespace std;ll n,k,ans,cnt=0;bool a[1000010];class cla{
};struct str{
};namespace funtion{ void FSIO() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); return; }};using namespace funtion;int main(){ FSIO(); cin>>n>>k; for(int i=1;i<=k;i++) { ll x,y; cin>>x; y=x; while(y<=n) { if(a[y]==1) { a[y]=0; cnt--; } else { a[y]=1; cnt++; } y+=x; } ans=max(ans,cnt); } cout<<ans; return 0;}```:::