답안 #91613

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
91613 2018-12-28T16:28:39 Z model_code Journey (NOI18_journey) C
100 / 100
48 ms 7288 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

journey.c: In function 'arrayadd':
journey.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;
                                              ^
journey.c: At top level:
journey.c:26:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main()
 ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 22 ms 2292 KB Output is correct
8 Correct 28 ms 7288 KB Output is correct
9 Correct 10 ms 2808 KB Output is correct
10 Correct 48 ms 2808 KB Output is correct