#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=1000005; int n,a[N],b[N]; long long m,f[N],s[N]; int ok(int w) { long long ans=0; for(int i=1;i<=n;i++) b[i]=a[i]; for(int i=2;i<=n;i++) if(b[…
D. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m. Ab…