Submission #565295

# Submission time Handle Problem Language Result Execution time Memory
565295 2022-05-20T16:02:29 Z Sorting Broken Device 2 (JOI22_device2) C++17
25 / 100
103 ms 3644 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(int 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 524 KB Output is correct
2 Correct 76 ms 3520 KB Output is correct
3 Correct 77 ms 3524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 524 KB Output is correct
2 Correct 76 ms 3520 KB Output is correct
3 Correct 77 ms 3524 KB Output is correct
4 Correct 81 ms 3336 KB Output is correct
5 Correct 90 ms 3328 KB Output is correct
6 Correct 82 ms 3636 KB Output is correct
7 Correct 80 ms 3472 KB Output is correct
8 Correct 86 ms 3320 KB Output is correct
9 Correct 76 ms 3488 KB Output is correct
10 Correct 73 ms 3488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 524 KB Output is correct
2 Correct 76 ms 3520 KB Output is correct
3 Correct 77 ms 3524 KB Output is correct
4 Correct 81 ms 3336 KB Output is correct
5 Correct 90 ms 3328 KB Output is correct
6 Correct 82 ms 3636 KB Output is correct
7 Correct 80 ms 3472 KB Output is correct
8 Correct 86 ms 3320 KB Output is correct
9 Correct 76 ms 3488 KB Output is correct
10 Correct 73 ms 3488 KB Output is correct
11 Correct 78 ms 3596 KB Output is correct
12 Correct 80 ms 3476 KB Output is correct
13 Correct 103 ms 3412 KB Output is correct
14 Correct 78 ms 3468 KB Output is correct
15 Correct 77 ms 3340 KB Output is correct
16 Correct 74 ms 3340 KB Output is correct
17 Correct 82 ms 3432 KB Output is correct
18 Correct 89 ms 3356 KB Output is correct
19 Correct 80 ms 3568 KB Output is correct
20 Correct 80 ms 3592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 524 KB Output is correct
2 Correct 76 ms 3520 KB Output is correct
3 Correct 77 ms 3524 KB Output is correct
4 Correct 81 ms 3336 KB Output is correct
5 Correct 90 ms 3328 KB Output is correct
6 Correct 82 ms 3636 KB Output is correct
7 Correct 80 ms 3472 KB Output is correct
8 Correct 86 ms 3320 KB Output is correct
9 Correct 76 ms 3488 KB Output is correct
10 Correct 73 ms 3488 KB Output is correct
11 Correct 78 ms 3596 KB Output is correct
12 Correct 80 ms 3476 KB Output is correct
13 Correct 103 ms 3412 KB Output is correct
14 Correct 78 ms 3468 KB Output is correct
15 Correct 77 ms 3340 KB Output is correct
16 Correct 74 ms 3340 KB Output is correct
17 Correct 82 ms 3432 KB Output is correct
18 Correct 89 ms 3356 KB Output is correct
19 Correct 80 ms 3568 KB Output is correct
20 Correct 80 ms 3592 KB Output is correct
21 Correct 96 ms 3372 KB Output is correct
22 Correct 82 ms 3352 KB Output is correct
23 Correct 82 ms 3436 KB Output is correct
24 Correct 87 ms 3488 KB Output is correct
25 Correct 86 ms 3340 KB Output is correct
26 Correct 76 ms 3384 KB Output is correct
27 Correct 72 ms 3352 KB Output is correct
28 Correct 80 ms 3524 KB Output is correct
29 Correct 102 ms 3456 KB Output is correct
30 Correct 81 ms 3404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 524 KB Output is correct
2 Correct 76 ms 3520 KB Output is correct
3 Correct 77 ms 3524 KB Output is correct
4 Correct 81 ms 3336 KB Output is correct
5 Correct 90 ms 3328 KB Output is correct
6 Correct 82 ms 3636 KB Output is correct
7 Correct 80 ms 3472 KB Output is correct
8 Correct 86 ms 3320 KB Output is correct
9 Correct 76 ms 3488 KB Output is correct
10 Correct 73 ms 3488 KB Output is correct
11 Correct 78 ms 3596 KB Output is correct
12 Correct 80 ms 3476 KB Output is correct
13 Correct 103 ms 3412 KB Output is correct
14 Correct 78 ms 3468 KB Output is correct
15 Correct 77 ms 3340 KB Output is correct
16 Correct 74 ms 3340 KB Output is correct
17 Correct 82 ms 3432 KB Output is correct
18 Correct 89 ms 3356 KB Output is correct
19 Correct 80 ms 3568 KB Output is correct
20 Correct 80 ms 3592 KB Output is correct
21 Correct 96 ms 3372 KB Output is correct
22 Correct 82 ms 3352 KB Output is correct
23 Correct 82 ms 3436 KB Output is correct
24 Correct 87 ms 3488 KB Output is correct
25 Correct 86 ms 3340 KB Output is correct
26 Correct 76 ms 3384 KB Output is correct
27 Correct 72 ms 3352 KB Output is correct
28 Correct 80 ms 3524 KB Output is correct
29 Correct 102 ms 3456 KB Output is correct
30 Correct 81 ms 3404 KB Output is correct
31 Incorrect 78 ms 3404 KB Output isn't correct
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 80 ms 3644 KB Output isn't correct
2 Halted 0 ms 0 KB -