Submission #565299

# Submission time Handle Problem Language Result Execution time Memory
565299 2022-05-20T16:05:42 Z Sorting Broken Device 2 (JOI22_device2) C++17
25 / 100
101 ms 3552 KB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

static const int BITS = 60;

int Declare() {
    return 3 * BITS;
}

pair<vector<int>, vector<int>> Anna(ll a) {
    vector<int> v1, v2;
    for(int i = 0; i < 3 * BITS; i += 2){
        v1.push_back(0);
        v1.push_back(1);
    }
    for(ll i = 0; i < BITS; ++i){
        int bit = (a >> i) & 1;
        v2.push_back(bit);
        v2.push_back(bit);
        v2.push_back(bit);
    }
    return {v1, v2};
}
#include "Bruno.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

static const int BITS = 60;

ll Bruno(vector<int> u) {
    int curr = 0, prefix = 0;
    vector<int> bits;
    for(int i = 0; i < u.size(); ++i){
        prefix += u[i] ? 1 : -1;

        if(prefix <= curr - 3){
            bits.push_back(0);
            curr -= 3;
        }
        else if(prefix >= curr + 2){
            bits.push_back(1);
            curr += 3;
        }
    }

    ll ans = 0;
    for(ll i = 0; i < bits.size(); ++i)
        ans += bits[i] << i;
    return ans;
}

Compilation message

Bruno.cpp: In function 'll Bruno(std::vector<int>)':
Bruno.cpp:13:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i = 0; i < u.size(); ++i){
      |                    ~~^~~~~~~~~~
Bruno.cpp:27:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(ll i = 0; i < bits.size(); ++i)
      |                   ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 72 ms 3464 KB Output is correct
3 Correct 78 ms 3408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 72 ms 3464 KB Output is correct
3 Correct 78 ms 3408 KB Output is correct
4 Correct 79 ms 3412 KB Output is correct
5 Correct 86 ms 3384 KB Output is correct
6 Correct 78 ms 3524 KB Output is correct
7 Correct 77 ms 3360 KB Output is correct
8 Correct 81 ms 3328 KB Output is correct
9 Correct 84 ms 3336 KB Output is correct
10 Correct 92 ms 3416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 72 ms 3464 KB Output is correct
3 Correct 78 ms 3408 KB Output is correct
4 Correct 79 ms 3412 KB Output is correct
5 Correct 86 ms 3384 KB Output is correct
6 Correct 78 ms 3524 KB Output is correct
7 Correct 77 ms 3360 KB Output is correct
8 Correct 81 ms 3328 KB Output is correct
9 Correct 84 ms 3336 KB Output is correct
10 Correct 92 ms 3416 KB Output is correct
11 Correct 74 ms 3344 KB Output is correct
12 Correct 79 ms 3536 KB Output is correct
13 Correct 93 ms 3516 KB Output is correct
14 Correct 78 ms 3312 KB Output is correct
15 Correct 77 ms 3328 KB Output is correct
16 Correct 73 ms 3380 KB Output is correct
17 Correct 74 ms 3324 KB Output is correct
18 Correct 83 ms 3440 KB Output is correct
19 Correct 80 ms 3348 KB Output is correct
20 Correct 78 ms 3424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 72 ms 3464 KB Output is correct
3 Correct 78 ms 3408 KB Output is correct
4 Correct 79 ms 3412 KB Output is correct
5 Correct 86 ms 3384 KB Output is correct
6 Correct 78 ms 3524 KB Output is correct
7 Correct 77 ms 3360 KB Output is correct
8 Correct 81 ms 3328 KB Output is correct
9 Correct 84 ms 3336 KB Output is correct
10 Correct 92 ms 3416 KB Output is correct
11 Correct 74 ms 3344 KB Output is correct
12 Correct 79 ms 3536 KB Output is correct
13 Correct 93 ms 3516 KB Output is correct
14 Correct 78 ms 3312 KB Output is correct
15 Correct 77 ms 3328 KB Output is correct
16 Correct 73 ms 3380 KB Output is correct
17 Correct 74 ms 3324 KB Output is correct
18 Correct 83 ms 3440 KB Output is correct
19 Correct 80 ms 3348 KB Output is correct
20 Correct 78 ms 3424 KB Output is correct
21 Correct 83 ms 3552 KB Output is correct
22 Correct 77 ms 3412 KB Output is correct
23 Correct 96 ms 3420 KB Output is correct
24 Correct 76 ms 3424 KB Output is correct
25 Correct 78 ms 3488 KB Output is correct
26 Correct 76 ms 3384 KB Output is correct
27 Correct 74 ms 3392 KB Output is correct
28 Correct 101 ms 3308 KB Output is correct
29 Correct 74 ms 3444 KB Output is correct
30 Correct 76 ms 3380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 72 ms 3464 KB Output is correct
3 Correct 78 ms 3408 KB Output is correct
4 Correct 79 ms 3412 KB Output is correct
5 Correct 86 ms 3384 KB Output is correct
6 Correct 78 ms 3524 KB Output is correct
7 Correct 77 ms 3360 KB Output is correct
8 Correct 81 ms 3328 KB Output is correct
9 Correct 84 ms 3336 KB Output is correct
10 Correct 92 ms 3416 KB Output is correct
11 Correct 74 ms 3344 KB Output is correct
12 Correct 79 ms 3536 KB Output is correct
13 Correct 93 ms 3516 KB Output is correct
14 Correct 78 ms 3312 KB Output is correct
15 Correct 77 ms 3328 KB Output is correct
16 Correct 73 ms 3380 KB Output is correct
17 Correct 74 ms 3324 KB Output is correct
18 Correct 83 ms 3440 KB Output is correct
19 Correct 80 ms 3348 KB Output is correct
20 Correct 78 ms 3424 KB Output is correct
21 Correct 83 ms 3552 KB Output is correct
22 Correct 77 ms 3412 KB Output is correct
23 Correct 96 ms 3420 KB Output is correct
24 Correct 76 ms 3424 KB Output is correct
25 Correct 78 ms 3488 KB Output is correct
26 Correct 76 ms 3384 KB Output is correct
27 Correct 74 ms 3392 KB Output is correct
28 Correct 101 ms 3308 KB Output is correct
29 Correct 74 ms 3444 KB Output is correct
30 Correct 76 ms 3380 KB Output is correct
31 Incorrect 82 ms 3432 KB Output isn't correct
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 96 ms 3484 KB Output isn't correct
2 Halted 0 ms 0 KB -