SPOJ-TROOPS-WA

Revision en1, by stostap, 2016-06-06 11:26:30

http://www.spoj.com/problems/TROOPS/

Hi, could you give any hints why dp approach here giving WA?

REP(i, n) {
 int x,y,z;
 scanf("%d%d%d", &x, &y, &z);
 FOR(j, max(1, y - x + 1), y + 1) {
  a[j] = max(a[j], z);
 }
}
int sum = 0;
REP(i, T) {
 sum += a[i];
}

Thanks!

Tags spoj, troops, wa, dp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English stostap 2016-06-06 11:26:30 313 Initial revision (published)