0_0_39602529_12193.cpp:1:10: fatal error: gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stdc++.h>usin: Invalid argument
1 | #include <bits/stdc++.h>using namespace std;#define int long longconst int N=2e5+5; int T,n,k,a[N];bool vis[N]; bool check(int x){ int ret = 0; set <pair<int, int> > s; for (int r = 1; r <= n; ++ r) { int fl = 0; for (auto [v, l]: s) { if (a[r] - v < x) break; else if (!vis[r - l + 1]) { fl = 1; break; } } if (fl) s.clear(), ++ ret; else s.insert(make_pair(a[r - 1], r)); if (ret >= k) return true; } return false;}signed main(){ std::ios::sync_with_stdio(0), std::cin.tie(0); for (int i = 2; i < N; ++ i) { for (int j = 2; i * j < N; ++ j) { vis[i * j] = 1; } } cin>>T; while(T--){ cin>>n>>k; for(int i=1;i<=n;++i){ cin>>a[i]; a[i]+=a[i-1]; } if(n<2*k){ cout << "impossible"; continue; } int l=-2000ll,r=1e7; int ans=l; while(l<=r){ int mid=(l+r)/2; if(check(mid)){ l=mid+1; ans=max(ans,mid); }else r=mid-1; } cout<<ans<<'\n'; } return 0;}/*52 5 4 01 10 49 11 10 52 01 10 52 51 10 52 50*/
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
|