제출 #262274

#제출 시각아이디문제언어결과실행 시간메모리
262274evpipis무지개나라 (APIO17_rainbow)C++11
컴파일 에러
0 ms0 KiB
#include "rainbow.h" #include <stdio.h> static int R, C, M, Q; static int sr, sc; static char S[100000 + 5]; int main() { freopen("sample.in", "r", stdin); scanf("%d %d %d %d", &R, &C, &M, &Q); scanf("%d %d", &sr, &sc); if (M > 0) { scanf(" %s ", S); } init(R, C, sr, sc, M, S); int query; for (query = 0; query < Q; query++) { int ar, ac, br, bc; scanf("%d %d %d %d", &ar, &ac, &br, &bc); printf("%d\n", colour(ar, ac, br, bc)); } return 0; } /* 6 4 9 4 3 3 NWESSWEWS 2 3 2 3 3 2 4 4 5 3 6 4 1 2 5 3 */

컴파일 시 표준 에러 (stderr) 메시지

rainbow.cpp: In function 'int main()':
rainbow.cpp:10:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   10 |     freopen("sample.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
rainbow.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |     scanf("%d %d %d %d", &R, &C, &M, &Q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rainbow.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |     scanf("%d %d", &sr, &sc);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
rainbow.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |         scanf(" %s ", S);
      |         ~~~~~^~~~~~~~~~~
rainbow.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   24 |         scanf("%d %d %d %d", &ar, &ac, &br, &bc);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ccQXMeET.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccFZMWgq.o:rainbow.cpp:(.text.startup+0x0): first defined here
/tmp/ccFZMWgq.o: In function `main':
rainbow.cpp:(.text.startup+0xa3): undefined reference to `init(int, int, int, int, int, char*)'
rainbow.cpp:(.text.startup+0xec): undefined reference to `colour(int, int, int, int)'
/tmp/ccQXMeET.o: In function `main':
grader.cpp:(.text.startup+0xcc): undefined reference to `init(int, int, int, int, int, char*)'
grader.cpp:(.text.startup+0x131): undefined reference to `colour(int, int, int, int)'
collect2: error: ld returned 1 exit status