Submission #319592

# Submission time Handle Problem Language Result Execution time Memory
319592 2020-11-05T15:57:54 Z knon0501 Detecting Molecules (IOI16_molecules) C++14
Compilation error
0 ms 0 KB
#include <cstdio>
#include <vector>
#include <cassert>

#include "molecules.h"

int main() {
    freopen("input.txt","r",stdin);

    int n, l, u;
    assert(3 == scanf("%d %d %d", &n, &l, &u));
    std::vector<int> w(n);
    for (int i = 0; i < n; i++)
        assert(1 == scanf("%d", &w[i]));
    std::vector<int> result = find_subset(l, u, w);


    printf("%d\n", (int)result.size());
    for (int i = 0; i < (int)result.size(); i++)
        printf("%d%c", result[i], " \n"[i == (int)result.size() - 1]);
}

Compilation message

molecules.cpp: In function 'int main()':
molecules.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     freopen("input.txt","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/tmp/ccVaVAjU.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccJ1Zhr2.o:molecules.cpp:(.text.startup+0x0): first defined here
/tmp/ccJ1Zhr2.o: In function `main':
molecules.cpp:(.text.startup+0x149): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
/tmp/ccVaVAjU.o: In function `main':
grader.cpp:(.text.startup+0x139): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status