답안 #565304

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
565304 2022-05-20T16:10:02 Z Sorting Broken Device 2 (JOI22_device2) C++17
25 / 100
99 ms 3592 KB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

static const int BITS = 60;
static const int C = 3;

int Declare() {
    return C * BITS;
}

pair<vector<int>, vector<int>> Anna(ll a) {
    vector<int> v1, v2;
    for(ll i = 0; i < C * BITS; i += 2){
        v1.push_back(0);
        v1.push_back(1);
    }
    for(ll i = 0; i < BITS; ++i){
        ll bit = (a >> i) & 1ll;
        for(ll j = 0; j < C; ++j)
            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;
static const int C = 3;

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

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

    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:14: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]
   14 |     for(ll i = 0; i < u.size(); ++i){
      |                   ~~^~~~~~~~~~
Bruno.cpp:28: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]
   28 |     for(ll i = 0; i < bits.size(); ++i)
      |                   ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 71 ms 3428 KB Output is correct
3 Correct 75 ms 3520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 71 ms 3428 KB Output is correct
3 Correct 75 ms 3520 KB Output is correct
4 Correct 78 ms 3424 KB Output is correct
5 Correct 75 ms 3504 KB Output is correct
6 Correct 75 ms 3532 KB Output is correct
7 Correct 81 ms 3424 KB Output is correct
8 Correct 78 ms 3440 KB Output is correct
9 Correct 76 ms 3452 KB Output is correct
10 Correct 68 ms 3328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 71 ms 3428 KB Output is correct
3 Correct 75 ms 3520 KB Output is correct
4 Correct 78 ms 3424 KB Output is correct
5 Correct 75 ms 3504 KB Output is correct
6 Correct 75 ms 3532 KB Output is correct
7 Correct 81 ms 3424 KB Output is correct
8 Correct 78 ms 3440 KB Output is correct
9 Correct 76 ms 3452 KB Output is correct
10 Correct 68 ms 3328 KB Output is correct
11 Correct 74 ms 3500 KB Output is correct
12 Correct 78 ms 3464 KB Output is correct
13 Correct 77 ms 3504 KB Output is correct
14 Correct 72 ms 3464 KB Output is correct
15 Correct 74 ms 3488 KB Output is correct
16 Correct 72 ms 3420 KB Output is correct
17 Correct 77 ms 3516 KB Output is correct
18 Correct 88 ms 3348 KB Output is correct
19 Correct 73 ms 3396 KB Output is correct
20 Correct 75 ms 3448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 71 ms 3428 KB Output is correct
3 Correct 75 ms 3520 KB Output is correct
4 Correct 78 ms 3424 KB Output is correct
5 Correct 75 ms 3504 KB Output is correct
6 Correct 75 ms 3532 KB Output is correct
7 Correct 81 ms 3424 KB Output is correct
8 Correct 78 ms 3440 KB Output is correct
9 Correct 76 ms 3452 KB Output is correct
10 Correct 68 ms 3328 KB Output is correct
11 Correct 74 ms 3500 KB Output is correct
12 Correct 78 ms 3464 KB Output is correct
13 Correct 77 ms 3504 KB Output is correct
14 Correct 72 ms 3464 KB Output is correct
15 Correct 74 ms 3488 KB Output is correct
16 Correct 72 ms 3420 KB Output is correct
17 Correct 77 ms 3516 KB Output is correct
18 Correct 88 ms 3348 KB Output is correct
19 Correct 73 ms 3396 KB Output is correct
20 Correct 75 ms 3448 KB Output is correct
21 Correct 73 ms 3380 KB Output is correct
22 Correct 99 ms 3324 KB Output is correct
23 Correct 76 ms 3504 KB Output is correct
24 Correct 76 ms 3472 KB Output is correct
25 Correct 77 ms 3364 KB Output is correct
26 Correct 75 ms 3444 KB Output is correct
27 Correct 71 ms 3384 KB Output is correct
28 Correct 73 ms 3456 KB Output is correct
29 Correct 73 ms 3480 KB Output is correct
30 Correct 79 ms 3440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 520 KB Output is correct
2 Correct 71 ms 3428 KB Output is correct
3 Correct 75 ms 3520 KB Output is correct
4 Correct 78 ms 3424 KB Output is correct
5 Correct 75 ms 3504 KB Output is correct
6 Correct 75 ms 3532 KB Output is correct
7 Correct 81 ms 3424 KB Output is correct
8 Correct 78 ms 3440 KB Output is correct
9 Correct 76 ms 3452 KB Output is correct
10 Correct 68 ms 3328 KB Output is correct
11 Correct 74 ms 3500 KB Output is correct
12 Correct 78 ms 3464 KB Output is correct
13 Correct 77 ms 3504 KB Output is correct
14 Correct 72 ms 3464 KB Output is correct
15 Correct 74 ms 3488 KB Output is correct
16 Correct 72 ms 3420 KB Output is correct
17 Correct 77 ms 3516 KB Output is correct
18 Correct 88 ms 3348 KB Output is correct
19 Correct 73 ms 3396 KB Output is correct
20 Correct 75 ms 3448 KB Output is correct
21 Correct 73 ms 3380 KB Output is correct
22 Correct 99 ms 3324 KB Output is correct
23 Correct 76 ms 3504 KB Output is correct
24 Correct 76 ms 3472 KB Output is correct
25 Correct 77 ms 3364 KB Output is correct
26 Correct 75 ms 3444 KB Output is correct
27 Correct 71 ms 3384 KB Output is correct
28 Correct 73 ms 3456 KB Output is correct
29 Correct 73 ms 3480 KB Output is correct
30 Correct 79 ms 3440 KB Output is correct
31 Incorrect 85 ms 3316 KB Output isn't correct
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 78 ms 3592 KB Output isn't correct
2 Halted 0 ms 0 KB -