提交记录 6603
用户 | 题目 | 状态 | 得分 | 用时 | 内存 | 语言 | 代码长度 |
---|---|---|---|---|---|---|---|
FlashHu | noi17e. 【NOI2017】蔬菜 | Accepted | 100 | 45.349 ms | 16268 KB | C++ | 1.40 KB |
提交时间 | 评测时间 |
---|---|
2018-10-30 16:53:52 | 2020-08-01 00:46:39 |
#include<bits/stdc++.h>
#define LL long long
#define RG register
#define R RG int
#define G if(++ip==ie)fread(ip=buf,1,N,stdin)
using namespace std;
const int N=2e5+9,M=1e6+9;
char buf[N],*ie=buf+N,*ip=ie-1;
int p[N],f[M];LL ans[M];
inline int in(){
G;while(*ip<'-')G;
R x=*ip&15;G;
while(*ip>'-'){x*=10;x+=*ip&15;G;}
return x;
}
struct Veg{
int a,c,x;
inline bool operator<(RG Veg&b){
return a>b.a;
}
}v[N];
int getf(R x){
return x==f[x]?x:f[x]=getf(f[x]);
}
int main(){
R n=in(),m=in(),k=in(),i,l=0;
for(i=1;i<=n;++i){
v[i].a=in();v[i+n].a=v[i].a+in();
v[i].c=in()-1;v[i+n].c=1;
if((v[i].x=in()))v[i+n].x=-(v[i].c/v[i].x+1);
}
for(i=1;i<=k;++i)l=max(l,p[i]=in());
R tot=l*m,j=1,t=0,x;
for(i=1;i<=tot;++i)f[i]=i;
sort(v+1,v+(n*=2)+1);
for(i=1;i<=n;++i){
//printf("a%d c%d x%d\n",v[i].a,v[i].c,v[i].x);
while(v[i].c){
--v[i].c;
x=v[i].x==0?tot:min((v[i].x>0?(v[i].c/v[i].x+1):-v[i].x)*m,tot);
//printf("x%d ",x);
x=getf(x);
//printf("f%d\n",x);
if(!x)break;
//puts("get");
--f[f[x]];ans[j]+=v[i].a;
if(++t==m){
if(++j>tot)goto F;
t=0;ans[j]=ans[j-1];
}
}
}
F:for(++j;j<=tot;++j)ans[j]=ans[j-1];
for(i=1;i<=k;++i)printf("%lld\n",ans[p[i]]);
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 272.66 us | 184 KB | Accepted | Score: 4 | 显示更多 |
Testcase #2 | 330.37 us | 188 KB | Accepted | Score: 4 | 显示更多 |
Testcase #3 | 312.82 us | 188 KB | Accepted | Score: 4 | 显示更多 |
Testcase #4 | 156.74 us | 104 KB | Accepted | Score: 4 | 显示更多 |
Testcase #5 | 156.35 us | 104 KB | Accepted | Score: 4 | 显示更多 |
Testcase #6 | 158.45 us | 104 KB | Accepted | Score: 4 | 显示更多 |
Testcase #7 | 38.89 us | 56 KB | Accepted | Score: 4 | 显示更多 |
Testcase #8 | 40.49 us | 56 KB | Accepted | Score: 4 | 显示更多 |
Testcase #9 | 38.53 us | 56 KB | Accepted | Score: 4 | 显示更多 |
Testcase #10 | 39.11 us | 56 KB | Accepted | Score: 4 | 显示更多 |
Testcase #11 | 50.45 us | 56 KB | Accepted | Score: 4 | 显示更多 |
Testcase #12 | 82.5 us | 68 KB | Accepted | Score: 4 | 显示更多 |
Testcase #13 | 76.06 us | 68 KB | Accepted | Score: 4 | 显示更多 |
Testcase #14 | 83.84 us | 72 KB | Accepted | Score: 4 | 显示更多 |
Testcase #15 | 85.63 us | 72 KB | Accepted | Score: 4 | 显示更多 |
Testcase #16 | 421.33 us | 228 KB | Accepted | Score: 4 | 显示更多 |
Testcase #17 | 517.68 us | 228 KB | Accepted | Score: 4 | 显示更多 |
Testcase #18 | 435.96 us | 236 KB | Accepted | Score: 4 | 显示更多 |
Testcase #19 | 541.45 us | 236 KB | Accepted | Score: 4 | 显示更多 |
Testcase #20 | 544.19 us | 240 KB | Accepted | Score: 4 | 显示更多 |
Testcase #21 | 44.476 ms | 15 MB + 868 KB | Accepted | Score: 4 | 显示更多 |
Testcase #22 | 43.293 ms | 15 MB + 908 KB | Accepted | Score: 4 | 显示更多 |
Testcase #23 | 45.349 ms | 15 MB + 872 KB | Accepted | Score: 4 | 显示更多 |
Testcase #24 | 44.827 ms | 15 MB + 880 KB | Accepted | Score: 4 | 显示更多 |
Testcase #25 | 44.984 ms | 15 MB + 876 KB | Accepted | Score: 4 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-10-05 10:57:04 | Loaded in 2 ms | Server Status
个人娱乐项目,仅供学习交流使用