# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
636565 | 2022-08-29T14:56:35 Z | rainboy | Sightseeing in Kyoto (JOI22_kyoto) | C | 컴파일 오류 |
0 ms | 0 KB |
C#include <stdio.h> #include <string.h> #define N 100000 #define M 100000 #define N_ 3000 #define M_ 3000 #define INF 0x3f3f3f3f3f3f3f3f long long min(long long a, long long b) { return a < b ? a : b; } long long cross2(int x1, int y1, int x2, int y2) { return (long long) x1 * y2 - (long long) x2 * y1; } long long cross(int x0, int y0, int x1, int y1, int x2, int y2) { return cross2(x1 - x0, y1 - y0, x2 - x0, y2 - y0); } int main() { static int aa[N], bb[M], ii[N_], jj[M_]; static long long dp[N_][M_]; int n, n_, m, m_, i, j; scanf("%d%d", &n, &m); for (i = 0; i < n; i++) scanf("%d", &aa[i]); for (j = 0; j < m; j++) scanf("%d", &bb[j]); n_ = 0; for (i = 0; i < n; i++) { while (n_ >= 2 && cross(ii[n_ - 2], aa[ii[n_ - 2]], ii[n_ - 1], aa[ii[n_ - 1]], i, aa[i]) <= 0) n_--; ii[n_++] = i; } m_ = 0; for (j = 0; j < m; j++) { while (m_ >= 2 && cross(jj[m_ - 2], bb[jj[m_ - 2]], jj[m_ - 1], bb[jj[m_ - 1]], j, bb[j]) <= 0) m_--; jj[m_++] = j; } for (i = 0; i < n_; i++) memset(dp[i], 0x3f, m_ * sizeof *dp[i]); dp[0][0] = 0; for (i = 0; i < n_; i++) for (j = 0; j < m_; j++) { long long x = dp[i][j]; if (x == INF) continue; if (j + 1 < m_) dp[i][j + 1] = min(dp[i][j + 1], x + (long long) aa[ii[i]] * (jj[j + 1] - jj[j])); if (i + 1 < n_) dp[i + 1][j] = min(dp[i + 1][j], x + (long long) bb[jj[j]] * (ii[i + 1] - ii[i])); } printf("%lld\n", dp[n_ - 1][m_ - 1]); return 0; }
Compilation message
kyoto.c:1:2: error: stray '#' in program 1 | C#include <stdio.h> | ^ kyoto.c:1:1: error: unknown type name 'C' 1 | C#include <stdio.h> | ^ kyoto.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | C#include <stdio.h> | ^ In file included from kyoto.c:2: /usr/include/string.h:44:8: error: unknown type name 'size_t' 44 | size_t __n) __THROW __nonnull ((1, 2)); | ^~~~~~ /usr/include/string.h:34:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? 33 | #include <stddef.h> +++ |+#include <stddef.h> 34 | /usr/include/string.h:47:56: error: unknown type name 'size_t' 47 | extern void *memmove (void *__dest, const void *__src, size_t __n) | ^~~~~~ /usr/include/string.h:47:56: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:55:18: error: unknown type name 'size_t' 55 | int __c, size_t __n) | ^~~~~~ /usr/include/string.h:55:18: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:61:42: error: unknown type name 'size_t' 61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); | ^~~~~~ /usr/include/string.h:61:42: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:64:56: error: unknown type name 'size_t' 64 | extern int memcmp (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:64:56: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:91:48: error: unknown type name 'size_t' 91 | extern void *memchr (const void *__s, int __c, size_t __n) | ^~~~~~ /usr/include/string.h:91:48: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:126:39: error: unknown type name 'size_t' 126 | const char *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:126:39: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:134:9: error: unknown type name 'size_t' 134 | size_t __n) __THROW __nonnull ((1, 2)); | ^~~~~~ /usr/include/string.h:134:9: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:140:57: error: unknown type name 'size_t' 140 | extern int strncmp (const char *__s1, const char *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:140:57: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:147:8: error: unknown type name 'size_t' 147 | extern size_t strxfrm (char *__restrict __dest, | ^~~~~~ /usr/include/string.h:148:40: error: unknown type name 'size_t' 148 | const char *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:148:40: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? In file included from kyoto.c:2: /usr/include/string.h:160:8: error: unknown type name 'size_t' 160 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, | ^~~~~~ /usr/include/string.h:160:59: error: unknown type name 'size_t' 160 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, | ^~~~~~ /usr/include/string.h:160:59: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:175:45: error: unknown type name 'size_t' 175 | extern char *strndup (const char *__string, size_t __n) | ^~~~~~ /usr/include/string.h:175:45: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:273:8: error: unknown type name 'size_t' 273 | extern size_t strcspn (const char *__s, const char *__reject) | ^~~~~~ /usr/include/string.h:277:8: error: unknown type name 'size_t' 277 | extern size_t strspn (const char *__s, const char *__accept) | ^~~~~~ /usr/include/string.h:385:8: error: unknown type name 'size_t' 385 | extern size_t strlen (const char *__s) | ^~~~~~ /usr/include/string.h:391:8: error: unknown type name 'size_t' 391 | extern size_t strnlen (const char *__string, size_t __maxlen) | ^~~~~~ /usr/include/string.h:391:46: error: unknown type name 'size_t' 391 | extern size_t strnlen (const char *__string, size_t __maxlen) | ^~~~~~ /usr/include/string.h:391:46: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/string.h:26, from kyoto.c:2: /usr/include/string.h:410:12: error: unknown type name 'size_t' 410 | extern int __REDIRECT_NTH (strerror_r, | ^~~~~~~~~~~~~~ /usr/include/string.h:410:12: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? In file included from /usr/include/string.h:432, from kyoto.c:2: /usr/include/strings.h:34:54: error: unknown type name 'size_t' 34 | extern int bcmp (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/strings.h:24:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? 23 | #include <stddef.h> +++ |+#include <stddef.h> 24 | /usr/include/strings.h:38:53: error: unknown type name 'size_t' 38 | extern void bcopy (const void *__src, void *__dest, size_t __n) | ^~~~~~ /usr/include/strings.h:38:53: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/strings.h:42:31: error: unknown type name 'size_t' 42 | extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); | ^~~~~~ /usr/include/strings.h:42:31: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/strings.h:120:61: error: unknown type name 'size_t' 120 | extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) | ^~~~~~ /usr/include/strings.h:120:61: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/strings.h:134:6: error: unknown type name 'size_t' 134 | size_t __n, locale_t __loc) | ^~~~~~ /usr/include/strings.h:134:6: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/string.h:26, from kyoto.c:2: /usr/include/x86_64-linux-gnu/bits/strings_fortified.h:23:1: error: unknown type name 'size_t' 23 | __NTH (bcopy (const void *__src, void *__dest, size_t __len)) | ^~~~~ In file included from /usr/include/strings.h:144, from /usr/include/string.h:432, from kyoto.c:2: /usr/include/x86_64-linux-gnu/bits/strings_fortified.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? +++ |+#include <stddef.h> 1 | /* Fortify macros for strings.h functions. In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/string.h:26, from kyoto.c:2: /usr/include/x86_64-linux-gnu/bits/strings_fortified.h:29:1: error: unknown type name 'size_t' 29 | __NTH (bzero (void *__dest, size_t __len)) | ^~~~~ /usr/include/x86_64-linux-gnu/bits/strings_fortified.h:29:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? In file included from kyoto.c:2: /usr/include/string.h:436:40: error: unknown type name 'size_t' 436 | extern void explicit_bzero (void *__s, size_t __n) __THROW __nonnull ((1)); | ^~~~~~ /usr/include/string.h:436:40: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:458:34: error: unknown type name 'size_t' 458 | const char *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:458:34: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/string.h:461:39: error: unknown type name 'size_t' 461 | const char *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:461:39: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/string.h:26, from kyoto.c:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:31:1: error: unknown type name 'size_t' 31 | __NTH (memcpy (void *__restrict __dest, const void *__restrict __src, | ^~~~~ In file included from /usr/include/string.h:495, from kyoto.c:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? +++ |+#include <stddef.h> 1 | /* Copyright (C) 2004-2020 Free Software Foundation, Inc. In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/string.h:26, from kyoto.c:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:38:1: error: unknown type name 'size_t' 38 | __NTH (memmove (void *__dest, const void *__src, size_t __len)) | ^~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:38:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:1: error: unknown type name 'size_t' 59 | __NTH (memset (void *__dest, int __ch, size_t __len)) | ^~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? In file included from /usr/include/string.h:495, from kyoto.c:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:77:42: error: unknown type name 'size_t' 77 | void __explicit_bzero_chk (void *__dest, size_t __len, size_t __destlen) | ^~~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:77:42: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/x86_64-linux-gnu/bits/string_fortified.h:77:56: error: unknown type name 'size_t' 77 | void __explicit_bzero_chk (void *__dest, size_t __len, size_t __destlen) | ^~~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:77:56: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/string.h:26, from kyoto.c:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:81:1: error: unknown type name 'size_t' 81 | __NTH (explicit_bzero (void *__dest, size_t __len)) | ^~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:81:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/x86_64-linux-gnu/bits/string_fortified.h:103:1: error: unknown type name 'size_t' 103 | __NTH (strncpy (char *__restrict __dest, const char *__restrict __src, | ^~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:103:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? In file included from /usr/include/string.h:495, from kyoto.c:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:110:62: error: unknown type name 'size_t' 110 | extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n, | ^~~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:110:62: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/x86_64-linux-gnu/bits/string_fortified.h:111:8: error: unknown type name 'size_t' 111 | size_t __destlen) __THROW; | ^~~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:111:8: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/string.h:26, from kyoto.c:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:112:14: error: unknown type name 'size_t' 112 | extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src, | ^~~~~~~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:112:14: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/x86_64-linux-gnu/bits/string_fortified.h:116:1: error: unknown type name 'size_t' 116 | __NTH (stpncpy (char *__dest, const char *__src, size_t __n)) | ^~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:116:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? /usr/include/x86_64-linux-gnu/bits/string_fortified.h:133:1: error: unknown type name 'size_t' 133 | __NTH (strncat (char *__restrict __dest, const char *__restrict __src, | ^~~~~ /usr/include/x86_64-linux-gnu/bits/string_fortified.h:133:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? kyoto.c: In function 'main': kyoto.c:25:2: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 25 | scanf("%d%d", &n, &m); | ^~~~~ kyoto.c:25:2: warning: incompatible implicit declaration of built-in function 'scanf' kyoto.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf' 2 | #include <string.h> +++ |+#include <stdio.h> 3 | kyoto.c:43:3: warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration] 43 | memset(dp[i], 0x3f, m_ * sizeof *dp[i]); | ^~~~~~ kyoto.c:43:3: warning: incompatible implicit declaration of built-in function 'memset' kyoto.c:3:1: note: include '<string.h>' or provide a declaration of 'memset' 2 | #include <string.h> +++ |+#include <string.h> 3 | kyoto.c:56:2: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 56 | printf("%lld\n", dp[n_ - 1][m_ - 1]); | ^~~~~~ kyoto.c:56:2: warning: incompatible implicit declaration of built-in function 'printf' kyoto.c:56:2: note: include '<stdio.h>' or provide a declaration of 'printf'