Submission #262274

# Submission time Handle Problem Language Result Execution time Memory
262274 2020-08-12T15:23:23 Z evpipis Land of the Rainbow Gold (APIO17_rainbow) C++11
Compilation error
0 ms 0 KB
#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
*/

Compilation message

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