# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
841050 | 2023-09-01T07:26:10 Z | Faisal_Saqib | A Plus B (IOI23_aplusb) | C++17 | 1 ms | 212 KB |
#include <iostream> #include <vector> #include <set> #include <algorithm> #include "aplusb.h" using namespace std; vector<int> smallest_sums(int n,vector<int> a ,vector<int> b) { vector<int> ans(n); int pak=0; int can[a.size()]; int m=b.size(); for(int i=0;i<n;i++) { can[i]=0; } set<pair<int,pair<int,int>>> pq; pq.insert({a[0]+b[0],{0,0}}); while(ans.size()<(n) and pq.size()>0) { auto p=*begin(pq); pq.erase(begin(pq)); ans[pak]=p.first; pak++; if(p.second.first< (n-1)){ pq.insert({a[p.second.first+1]+b[can[p.second.first+1]],{p.second.first+1,can[p.second.first+1]}}); } if(p.second.second< (m-1)) { pq.insert({a[p.second.first]+b[p.second.second+1],{p.second.first,p.second.second+1}}); can[p.second.first]+=1; } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '465', found: '0' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '465', found: '0' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '465', found: '0' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '465', found: '0' |
3 | Halted | 0 ms | 0 KB | - |