Submission #16239

#TimeUsernameProblemLanguageResultExecution timeMemory
16239eaststar택배 (KOI13_delivery)C++14
100 / 100
30 ms1208 KiB
#include <stdio.h> #include <algorithm> using namespace std; struct data{ int s,e,cnt; bool operator<(const data&r)const{ if(e==r.e)return s>r.s; return e<r.e; } }a[10010]; int s[2010],ans,mx; int main(){ int i,j,n,c,m; scanf("%d%d%d",&n,&c,&m); for(i=0;i<m;++i)scanf("%d%d%d",&a[i].s,&a[i].e,&a[i].cnt); sort(a,a+m); for(i=0;i<m;++i){ mx=0; for(j=a[i].s;j<a[i].e;++j)mx=max(mx,s[j]); mx=min(a[i].cnt,c-mx); for(j=a[i].s;j<a[i].e;++j)s[j]+=mx; ans+=mx; } printf("%d",ans); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...