Submission #849140

#TimeUsernameProblemLanguageResultExecution timeMemory
849140emad234A Plus B (IOI23_aplusb)C++17
10 / 100
1 ms500 KiB
#include <bits/stdc++.h> #define all(v) ((v).begin(),(v).end()) #define ll long long #define F first #define S second const ll mod = 1e9 + 7; const ll mxN = 1e5 + 2; using namespace std; struct number{ int val,iA,iB; }; bool operator<(number a,number b){ return a.val < b.val; } vector<int> smallest_sums(int N, vector<int> A, vector<int> B) { vector<int>ans; set<number>s; for(int i = 0;i < N;i++){ s.insert({A[0] + B[i],0,i}); } for(int i =0;i < N;i++){ ans.push_back((*(s.begin())).val); int iA = (*(s.begin())).iA; int iB = (*(s.begin())).iB; s.erase(s.begin()); s.insert({A[iA + 1] + B[iB],iA + 1,iB}); } return ans; } // // int main() { // int N; // assert(1 == scanf("%d", &N)); // std::vector<int> A(N); // for (int i = 0; i < N; ++i) // assert(1 == scanf("%d", &A[i])); // std::vector<int> B(N); // for (int i = 0; i < N; ++i) // assert(1 == scanf("%d", &B[i])); // // fclose(stdin); // // std::vector<int> res = smallest_sums(N, A, B); // // int n = res.size(); // for (int i = 0; i < n; ++i) { // if (i > 0) // printf(" "); // printf("%d", res[i]); // } // printf("\n"); // fclose(stdout); // // return 0; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...