Submission #5325

#TimeUsernameProblemLanguageResultExecution timeMemory
5325baneling100택배 (KOI13_delivery)C++98
100 / 100
20 ms1212 KiB
#include <stdio.h> #include <algorithm> using namespace std; typedef pair <int,int> ppair; pair <ppair,int> box[10001]; int n, c, m, d[2001], ans; void input(void) { int i, x, y, z; scanf("%d %d %d",&n,&c,&m); for(i=1 ; i<=m ; i++) { scanf("%d %d %d",&x,&y,&z); box[i]=make_pair(make_pair(y-1,-x),-z); } sort(box+1,box+m+1); } void process(void) { int i, j, mmin; for(i=1 ; i<=m ; i++) { box[i].first.second*=-1; box[i].second*=-1; mmin=box[i].second; for(j=box[i].first.second ; j<=box[i].first.first ; j++) if(mmin>c-d[j]) mmin=c-d[j]; for(j=box[i].first.second ; j<=box[i].first.first ; j++) d[j]+=mmin; ans+=mmin; } } void output(void) { printf("%d",ans); } int main(void) { input(); process(); output(); 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...