Submission #1123338

#TimeUsernameProblemLanguageResultExecution timeMemory
1123338njoopA Plus B (IOI23_aplusb)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define tii tuple<int, int, int> using namespace std; priority_queue<tii, vector<tii>, greater<tii>> pq; vector<int> ans; vector<int> smallest_sums(int N, vector<int> A, vector<int> B) { pq.push({A[0]+B[0], 0, 0}); ll l=0, r=2e9; while(l < r) { ll mid = l+(r-l)/2, cnt = 0; for(int i=0; i<N; i++) { cnt += upper_bound(B.begin(), B.end(), mid-A[i])-B.begin(); } if(cnt >= N) { r = mid; } else { l = mid+1; } } for(int i=0; i<N; i++) { for(int j=0; A[i]+B[j] <= l && j<N; j++) { ans.push_back(A[i]+B[j]); } } sort(ans.begin(), ans.end()); while(ans.size() > N) ans.pop_back(); return ans; } int main() { vector<int> v = smallest_sums(2, {0, 2}, {1, 4}); for(int i: v) { cout << i << " "; } return 0; }

Compilation message (stderr)

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