제출 #487959

#제출 시각아이디문제언어결과실행 시간메모리
487959BY_KUTBILIMDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
/* @AUTHOR: BY_KUTBILIM FILE CREATED: 16.11.2021 17:46:37 (GMT+6) */ #include <bits/stdc++.h> using namespace std; #define endl '\n' #define sz(x) int((x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define fi first #define se second #define pb push_back using ll = long long; using pii = pair<int, int>; vector<int> find_subset(int st, int dr, vector<int> w){ int n = sz(w); queue<pair<int,int>> q; vector<pair<int,int>> v; for(int i = 0; i < n; i++){ v.pb({w[i], i}); } sort(all(v)); int sum = 0; for(int i = 0; i < n; i++){ q.push(v[i]); sum += v[i].fi; while(sum > dr and !q.empty()){ sum -= q.front().fi; q.pop(); } if(st <= sum and sum <= dr){ vector<int> ans; while(!q.empty()){ ans.pb(q.front().se); q.pop(); } return ans; } } return vector<int>(0); } int main(){ int n; cin >> n; vector<int> w(n); for(int i = 0; i < n; i++){ cin >> w[i]; } int l, r; cin >> l >> r; vector<int> ans = find_subset(l, r, w); for(auto e : ans)cout << e << ' '; return 0; }

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

/usr/bin/ld: /tmp/ccwGxX2Z.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccK87ytY.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status