Submission #91619

# Submission time Handle Problem Language Result Execution time Memory
91619 2018-12-28T17:00:50 Z model_code Safety (NOI18_safety) C
0 / 100
2000 ms 1624 KB
#include <stdio.h>

long numbread()
  { char ch; long b;
    ch = ' ';
    while ((ch < '0') || (ch > '9'))
      { ch = getchar(); }
    b = 0;
    while ((ch >= '0') && (ch <= '9'))
      { b = b*10+(long)(ch-'0'); ch = getchar(); }
    return(b); }


void arrayadd(long i, long j, long k, long m, long n, long a[])
  { long x = m*i; long y = m*j; long p; long q; long v; long w;
    long u; u=0;
    for (p=0;p<m-k;p++)
      { if (i > 0) { v = a[x+p]; } else
          { if (p==0) { v = 1; } else { v = 0; } }
        u = u+v;
        if (u > 500000000) { u = 500000001; }
        w = u+a[y+p+k];
        if (w > 500000000) { w = 500000001; }
        a[y+p+k] = w; } }

main()
  {
  long n = numbread(); long m = numbread(); long h = numbread();
  long i,j,k,o;
  long consty = n*m;
  long a[consty];
  for (o=0;o<n*m;o++)
    { a[o] = 0; }
  for (i=0;i<n-1;i++)
    { for (o=0;o<h;o++)
        { j = numbread(); k = numbread();
          if ((i<j) && (j<n))
            { arrayadd(i,j,k,m,n,a); } } }
  for (o=n*m-m; o<n*m; o++)
    { printf("%ld ",a[o]); }
  putchar('\n');
  }

Compilation message

safety.c: In function 'arrayadd':
safety.c:15:46: warning: unused variable 'q' [-Wunused-variable]
   { long x = m*i; long y = m*j; long p; long q; long v; long w;
                                              ^
safety.c: At top level:
safety.c:26:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main()
 ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2063 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2025 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2049 ms 1624 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -