답안 #565301

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
565301 2022-05-20T16:06:58 Z Sorting Broken Device 2 (JOI22_device2) C++17
25 / 100
87 ms 3524 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) & 1ll;
        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;
    assert(bits.size() == BITS);
    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)
      |                   ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 508 KB Output is correct
2 Correct 86 ms 3324 KB Output is correct
3 Correct 82 ms 3504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 508 KB Output is correct
2 Correct 86 ms 3324 KB Output is correct
3 Correct 82 ms 3504 KB Output is correct
4 Correct 79 ms 3516 KB Output is correct
5 Correct 76 ms 3384 KB Output is correct
6 Correct 78 ms 3452 KB Output is correct
7 Correct 82 ms 3460 KB Output is correct
8 Correct 78 ms 3448 KB Output is correct
9 Correct 75 ms 3412 KB Output is correct
10 Correct 71 ms 3384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 508 KB Output is correct
2 Correct 86 ms 3324 KB Output is correct
3 Correct 82 ms 3504 KB Output is correct
4 Correct 79 ms 3516 KB Output is correct
5 Correct 76 ms 3384 KB Output is correct
6 Correct 78 ms 3452 KB Output is correct
7 Correct 82 ms 3460 KB Output is correct
8 Correct 78 ms 3448 KB Output is correct
9 Correct 75 ms 3412 KB Output is correct
10 Correct 71 ms 3384 KB Output is correct
11 Correct 77 ms 3424 KB Output is correct
12 Correct 79 ms 3492 KB Output is correct
13 Correct 75 ms 3328 KB Output is correct
14 Correct 79 ms 3424 KB Output is correct
15 Correct 80 ms 3416 KB Output is correct
16 Correct 79 ms 3324 KB Output is correct
17 Correct 71 ms 3392 KB Output is correct
18 Correct 79 ms 3344 KB Output is correct
19 Correct 83 ms 3444 KB Output is correct
20 Correct 78 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 508 KB Output is correct
2 Correct 86 ms 3324 KB Output is correct
3 Correct 82 ms 3504 KB Output is correct
4 Correct 79 ms 3516 KB Output is correct
5 Correct 76 ms 3384 KB Output is correct
6 Correct 78 ms 3452 KB Output is correct
7 Correct 82 ms 3460 KB Output is correct
8 Correct 78 ms 3448 KB Output is correct
9 Correct 75 ms 3412 KB Output is correct
10 Correct 71 ms 3384 KB Output is correct
11 Correct 77 ms 3424 KB Output is correct
12 Correct 79 ms 3492 KB Output is correct
13 Correct 75 ms 3328 KB Output is correct
14 Correct 79 ms 3424 KB Output is correct
15 Correct 80 ms 3416 KB Output is correct
16 Correct 79 ms 3324 KB Output is correct
17 Correct 71 ms 3392 KB Output is correct
18 Correct 79 ms 3344 KB Output is correct
19 Correct 83 ms 3444 KB Output is correct
20 Correct 78 ms 3412 KB Output is correct
21 Correct 77 ms 3424 KB Output is correct
22 Correct 80 ms 3456 KB Output is correct
23 Correct 79 ms 3524 KB Output is correct
24 Correct 78 ms 3392 KB Output is correct
25 Correct 87 ms 3436 KB Output is correct
26 Correct 74 ms 3456 KB Output is correct
27 Correct 74 ms 3376 KB Output is correct
28 Correct 79 ms 3384 KB Output is correct
29 Correct 80 ms 3388 KB Output is correct
30 Correct 75 ms 3420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 508 KB Output is correct
2 Correct 86 ms 3324 KB Output is correct
3 Correct 82 ms 3504 KB Output is correct
4 Correct 79 ms 3516 KB Output is correct
5 Correct 76 ms 3384 KB Output is correct
6 Correct 78 ms 3452 KB Output is correct
7 Correct 82 ms 3460 KB Output is correct
8 Correct 78 ms 3448 KB Output is correct
9 Correct 75 ms 3412 KB Output is correct
10 Correct 71 ms 3384 KB Output is correct
11 Correct 77 ms 3424 KB Output is correct
12 Correct 79 ms 3492 KB Output is correct
13 Correct 75 ms 3328 KB Output is correct
14 Correct 79 ms 3424 KB Output is correct
15 Correct 80 ms 3416 KB Output is correct
16 Correct 79 ms 3324 KB Output is correct
17 Correct 71 ms 3392 KB Output is correct
18 Correct 79 ms 3344 KB Output is correct
19 Correct 83 ms 3444 KB Output is correct
20 Correct 78 ms 3412 KB Output is correct
21 Correct 77 ms 3424 KB Output is correct
22 Correct 80 ms 3456 KB Output is correct
23 Correct 79 ms 3524 KB Output is correct
24 Correct 78 ms 3392 KB Output is correct
25 Correct 87 ms 3436 KB Output is correct
26 Correct 74 ms 3456 KB Output is correct
27 Correct 74 ms 3376 KB Output is correct
28 Correct 79 ms 3384 KB Output is correct
29 Correct 80 ms 3388 KB Output is correct
30 Correct 75 ms 3420 KB Output is correct
31 Incorrect 80 ms 3508 KB Output isn't correct
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 80 ms 3328 KB Output isn't correct
2 Halted 0 ms 0 KB -