Language: C++



#include<stdio.h>
#include<assert.h>
#include<string.h>
#include<math.h>
 
#define MAX 1001
#define MAX_C 100001
#define max(a,b) ((a>b)?a:b)
 
int C, N, c[MAX], v[MAX], i, j, dp[MAX_C];
 
int main() {
  scanf("%d %d",&N,&C);
  assert( N < MAX );
  assert( C < MAX_C );
  for(i=0;i<N;i++) scanf("%d %d",v+i,c+i);
   
  memset(dp,-1,sizeof dp);
  dp[0] = 0;
  /*
    // 01 Knapsack
  for(i=0;i<N;++i) {
    for(j=C;j>=0;--j) if( dp[j] != -1 ) {
      if( j + c[i] <= C ) {
    dp[j+c[i]] = max(dp[j+c[i]],dp[j]+v[i]);
      }
    }
  }
  */
  // Knapsack
  for(i=0;i<N;++i) {
    for(j=0;j<C;++j) if( dp[j] != -1 ) {
    if( j+c[i] <= C ) {
      dp[j+c[i]] = max(dp[j+c[i]],dp[j]+v[i]);
    }
      }
  }
 
  int maxi = 0;
  for(i=0;i<=C;i++) maxi = max(maxi,dp[i]);
  printf("%d\n",maxi);
   
  return 0;
}
 

 
Compile Error Logs: 

You are not authorized to see the message. 
 
 
??????????????? 
Judge: 40/40  C  CPU: 00.00 sec  Memory: 1000 KB  Length: 790 B  2016-05-25 14:36  2016-05-25 14:36  
???????????±????????????????????? 
Case # Verdict CPU Time Memory In Out Case Name 
 Case #1: : Accepted  00.00 sec 1000 KB 20 B 3 B 00_sample_00.in 
 Case #2: : Accepted  00.00 sec 1000 KB 14 B 3 B 00_sample_01.in 
 Case #3: : Accepted  00.00 sec 1000 KB 16 B 3 B 00_sample_02.in 
 Case #4: : Accepted  00.00 sec 1000 KB 24 B 2 B 01_small_00.in 
 Case #5: : Accepted  00.00 sec 1000 KB 24 B 3 B 01_small_01.in 
 Case #6: : Accepted  00.00 sec 1000 KB 24 B 3 B 01_small_02.in 
 Case #7: : Accepted  00.00 sec 1000 KB 25 B 4 B 01_small_03.in 
 Case #8: : Accepted  00.00 sec 1000 KB 86 B 4 B 02_rand_00.in 
 Case #9: : Accepted  00.00 sec 1000 KB 95 B 4 B 02_rand_01.in 
 Case #10: : Accepted  00.00 sec 1000 KB 108 B 5 B 02_rand_02.in 
 Case #11: : Accepted  00.00 sec 1000 KB 118 B 5 B 02_rand_03.in 
 Case #12: : Accepted  00.00 sec 1000 KB 117 B 5 B 02_rand_04.in 
  

Compiler output:
a.cc:57:12: error: extended character ± is not valid in an identifier
   57 | ???????????±?????????????????????
      |            ^
a.cc:58:6: error: stray '#' in program
   58 | Case # Verdict CPU Time Memory In Out Case Name
      |      ^
a.cc:59:7: error: stray '#' in program
   59 |  Case #1: : Accepted  00.00 sec 1000 KB 20 B 3 B 00_sample_00.in
      |       ^
a.cc:60:7: error: stray '#' in program
   60 |  Case #2: : Accepted  00.00 sec 1000 KB 14 B 3 B 00_sample_01.in
      |       ^
a.cc:61:7: error: stray '#' in program
   61 |  Case #3: : Accepted  00.00 sec 1000 KB 16 B 3 B 00_sample_02.in
      |       ^
a.cc:62:7: error: stray '#' in program
   62 |  Case #4: : Accepted  00.00 sec 1000 KB 24 B 2 B 01_small_00.in
      |       ^
a.cc:63:7: error: stray '#' in program
   63 |  Case #5: : Accepted  00.00 sec 1000 KB 24 B 3 B 01_small_01.in
      |       ^
a.cc:64:7: error: stray '#' in program
   64 |  Case #6: : Accepted  00.00 sec 1000 KB 24 B 3 B 01_small_02.in
      |       ^
a.cc:65:7: error: stray '#' in program
   65 |  Case #7: : Accepted  00.00 sec 1000 KB 25 B 4 B 01_small_03.in
      |       ^
a.cc:66:7: error: stray '#' in program
   66 |  Case #8: : Accepted  00.00 sec 1000 KB 86 B 4 B 02_rand_00.in
      |       ^
a.cc:67:7: error: stray '#' in program
   67 |  Case #9: : Accepted  00.00 sec 1000 KB 95 B 4 B 02_rand_01.in
      |       ^
a.cc:68:7: error: stray '#' in program
   68 |  Case #10: : Accepted  00.00 sec 1000 KB 108 B 5 B 02_rand_02.in
      |       ^
a.cc:69:7: error: stray '#' in program
   69 |  Case #11: : Accepted  00.00 sec 1000 KB 118 B 5 B 02_rand_03.in
      |       ^
a.cc:70:7: error: stray '#' in program
   70 |  Case #12: : Accepted  00.00 sec 1000 KB 117 B 5 B 02_rand_04.in
      |       ^
a.cc:50:1: error: 'Compile' does not name a type
   50 | Compile Error Logs:
      | ^~~~~~~