Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
1825 | 18级王浩宇 | 【S】T3 分块 | C++ | 运行超时 | 30 | 2000 MS | 15876 KB | 578 | 2020-11-16 10:54:51 |
#include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int n,m,ans; int L[N],R[N]; signed main() { scanf("%lld%lld",&n,&m); for(int i=1;i<=m;i++) scanf("%d%d",&L[i],&R[i]); for(int B=1;B<=n;B++) { ans=0; for(int i=1;i<=m;i++) { int l=L[i],r=R[i]; if((l-1)/B+1==(r-1)/B+1) ans+=(r-l+1); else ans+=B+(r-1)-(r-1)/B*(B-1)-(l-1)+(l-1)/B*(B-1); } printf("%lld ",ans); } return 0; }