제출 #711718

#제출 시각아이디문제언어결과실행 시간메모리
711718JANCARAPANDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long #define ll long long #define fi first #define se second #define pb push_back #define all(a) (a).begin(), (a).end() #define sz(a) (long long) a.size() #define endl '\n' #define dbg(a) cerr << #a << " = " << a << endl; #define print(a) for (auto x : a) cerr << x << " "; cerr << endl; const long long INF = 1e18, MOD = 1e9+7; vector<int> find_subset(int l, int r, vector<int> tmp) { int n = sz(tmp); vector<pair<int,int>> a(n); for (int i = 0; i < n; i++) { a[i] = {tmp[i], i}; } sort(all(a)); vector<int> pref(n), suff(n); for (int i = 0; i < n; i++) { pref[i] = a[i].fi + (i ? pref[i - 1] : 0); suff[n - i - 1] = a[n - i - 1].fi + (i ? suff[n - i] : 0); } vector<int> ans; for (int size = 0; size < n; size++) { if (pref[size] > r || suff[n - size - 1] < l) continue; ll cur = pref[size]; int j = 0; while (cur < l && j <= size) { cur += a[n - j - 1].fi - a[j].fi; j += 1; } if (cur >= l) { assert(cur <= r); for (int it = j; it <= size; it++) { ans.pb(a[it].se); } for (int it = n - 1; it >= n - j; it--) { ans.pb(a[it].se); } assert(sz(ans) > 0); break; } } return ans; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int l = 12, r = 12, n = 4; cin >> l >> r >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; vector<int> a = find_subset(l, r, v); for (auto x : a) cerr << x << " "; } //signed main() { //ios_base::sync_with_stdio(0); //cin.tie(0); //int tt = 1; //cin >> tt; //while (tt--) { //solve(); //} //return 0; //}

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

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