제출 #374823

#제출 시각아이디문제언어결과실행 시간메모리
374823Alex_tz307Detecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int r, vector<int> w) { int N = w.size(); vector<pair<int,int>> a(N); for(int i = 0; i < N; ++i) a[i] = make_pair(w[i], i); sort(a.begin(), a.end()); int st = -1, dr = 0; long long sum = 0; for(const int &x : w) sum += x; while(sum < l || sum > r) { while(sum > r) { if(dr == N) return {}; sum -= a[dr++].first; } while(sum < l) { if(st == N - 1) return {}; sum += a[++st].first; } } if(st < 0 || dr < 0 || st >= N || dr >= N) return {}; vector<int> sol; for(int i = 0; i <= st; ++i) sol.emplace_back(a[i].second); for(int i = dr; i < N; ++i) sol.emplace_back(a[i].second); return sol; } int main() { int N, l, r; cin >> N >> l >> r; vector<int> a(N); for(int &x : a) cin >> x; vector<int> sol = find_subset(l, r, a); for(const int &x : sol) cout << x << ' '; cout << endl; }

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

/tmp/ccosDydD.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccdmg3N4.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status