Submission #902390

# Submission time Handle Problem Language Result Execution time Memory
902390 2024-01-10T11:06:51 Z KK_1729 A Plus B (IOI23_aplusb) C++17
100 / 100
78 ms 9644 KB
#include "aplusb.h"
#include <bits/stdc++.h>
using namespace std;
     
// #define int long long
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(a) a.begin(), a.end()
#define endl "\n"
     
void printVector(vector<int> a){
    for (auto x: a) cout << x << " ";
    cout << endl;
}
     
vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
    vector<int> ans;

    multiset<pair<int, int>> o;
    vector<int> l(N+1);

    FOR(i,0,N) o.insert({A[i]+B[0], i});

    FOR(h,0,N){
        pair<int, int> x = *o.begin();
        
        ans.pb(x.first);
        o.erase(x);

        l[x.second]++;
        if (l[x.second] < N){
            o.insert({A[x.second]+B[l[x.second]], x.second});
        }
    }

    sort(all(ans));
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 496 KB Output is correct
2 Correct 1 ms 360 KB Output is correct
3 Correct 1 ms 360 KB Output is correct
4 Correct 0 ms 360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 496 KB Output is correct
2 Correct 1 ms 360 KB Output is correct
3 Correct 1 ms 360 KB Output is correct
4 Correct 0 ms 360 KB Output is correct
5 Correct 1 ms 360 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 432 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 504 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 360 KB Output is correct
19 Correct 1 ms 360 KB Output is correct
20 Correct 0 ms 360 KB Output is correct
21 Correct 1 ms 360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 496 KB Output is correct
2 Correct 1 ms 360 KB Output is correct
3 Correct 1 ms 360 KB Output is correct
4 Correct 0 ms 360 KB Output is correct
5 Correct 1 ms 360 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 432 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 504 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 360 KB Output is correct
19 Correct 1 ms 360 KB Output is correct
20 Correct 0 ms 360 KB Output is correct
21 Correct 1 ms 360 KB Output is correct
22 Correct 1 ms 360 KB Output is correct
23 Correct 1 ms 360 KB Output is correct
24 Correct 1 ms 360 KB Output is correct
25 Correct 1 ms 360 KB Output is correct
26 Correct 1 ms 616 KB Output is correct
27 Correct 2 ms 456 KB Output is correct
28 Correct 1 ms 616 KB Output is correct
29 Correct 0 ms 360 KB Output is correct
30 Correct 1 ms 360 KB Output is correct
31 Correct 1 ms 460 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 2 ms 480 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 496 KB Output is correct
2 Correct 1 ms 360 KB Output is correct
3 Correct 1 ms 360 KB Output is correct
4 Correct 0 ms 360 KB Output is correct
5 Correct 1 ms 360 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 432 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 504 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 360 KB Output is correct
19 Correct 1 ms 360 KB Output is correct
20 Correct 0 ms 360 KB Output is correct
21 Correct 1 ms 360 KB Output is correct
22 Correct 1 ms 360 KB Output is correct
23 Correct 1 ms 360 KB Output is correct
24 Correct 1 ms 360 KB Output is correct
25 Correct 1 ms 360 KB Output is correct
26 Correct 1 ms 616 KB Output is correct
27 Correct 2 ms 456 KB Output is correct
28 Correct 1 ms 616 KB Output is correct
29 Correct 0 ms 360 KB Output is correct
30 Correct 1 ms 360 KB Output is correct
31 Correct 1 ms 460 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 2 ms 480 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 9 ms 2392 KB Output is correct
38 Correct 38 ms 7124 KB Output is correct
39 Correct 40 ms 7380 KB Output is correct
40 Correct 38 ms 7388 KB Output is correct
41 Correct 73 ms 9528 KB Output is correct
42 Correct 54 ms 9428 KB Output is correct
43 Correct 52 ms 9136 KB Output is correct
44 Correct 12 ms 2396 KB Output is correct
45 Correct 44 ms 7496 KB Output is correct
46 Correct 44 ms 7484 KB Output is correct
47 Correct 41 ms 7284 KB Output is correct
48 Correct 60 ms 9644 KB Output is correct
49 Correct 62 ms 9424 KB Output is correct
50 Correct 67 ms 8912 KB Output is correct
51 Correct 65 ms 8664 KB Output is correct
52 Correct 76 ms 8756 KB Output is correct
53 Correct 78 ms 8736 KB Output is correct