제출 #700960

#제출 시각아이디문제언어결과실행 시간메모리
700960abczzDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <algorithm> #define ll long long using namespace std; ll n, l, r, ps[200000]; pair <ll, ll> a[200000]; int main() { cin >> n >> l >> r; for (int i=0; i<n; ++i) { cin >> a[i].first; a[i].second = i; } sort(a, a+n, [](auto a, auto b) { return a.first < b.first; }); for (int i=0; i<n; ++i) { if (i == 0) ps[i] = a[i].first; else ps[i] = ps[i-1] + a[i].first; } for (int i=0; i<n; ++i) { if (ps[i] >= l && ps[i] <= r) { cout << i+1 << endl; for (int j=0; j<=i; ++j) { cout << a[j].second << " "; } return 0; } } int i=0, j=0; while (max(i, j) < n) { if (ps[i]-ps[j] >= l && ps[i]-ps[j] <= r) { cout << i-j << endl; for (int k=j+1; k<=i; ++k) { cout << a[k].second << " "; } return 0; } else if (ps[i]-ps[j] > r) ++j; else ++i; } cout << 0 << endl; }

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

/usr/bin/ld: /tmp/cciJ3Vbu.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccxwb6Zs.o:molecules.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cciJ3Vbu.o: in function `main':
grader.cpp:(.text.startup+0x18d): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status