답안 #565303

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

using namespace std;

typedef long long ll;

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

int Declare() {
    return C * BITS;
}

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

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 - 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:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int 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 2 ms 516 KB Output is correct
2 Correct 114 ms 5328 KB Output is correct
3 Correct 121 ms 5324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 516 KB Output is correct
2 Correct 114 ms 5328 KB Output is correct
3 Correct 121 ms 5324 KB Output is correct
4 Correct 143 ms 5320 KB Output is correct
5 Correct 133 ms 5292 KB Output is correct
6 Correct 136 ms 5228 KB Output is correct
7 Correct 159 ms 5320 KB Output is correct
8 Correct 123 ms 5528 KB Output is correct
9 Correct 119 ms 5300 KB Output is correct
10 Correct 109 ms 5264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 516 KB Output is correct
2 Correct 114 ms 5328 KB Output is correct
3 Correct 121 ms 5324 KB Output is correct
4 Correct 143 ms 5320 KB Output is correct
5 Correct 133 ms 5292 KB Output is correct
6 Correct 136 ms 5228 KB Output is correct
7 Correct 159 ms 5320 KB Output is correct
8 Correct 123 ms 5528 KB Output is correct
9 Correct 119 ms 5300 KB Output is correct
10 Correct 109 ms 5264 KB Output is correct
11 Correct 119 ms 5304 KB Output is correct
12 Correct 141 ms 5412 KB Output is correct
13 Correct 117 ms 5400 KB Output is correct
14 Correct 121 ms 5292 KB Output is correct
15 Correct 142 ms 5364 KB Output is correct
16 Correct 134 ms 5268 KB Output is correct
17 Correct 117 ms 5256 KB Output is correct
18 Correct 120 ms 5244 KB Output is correct
19 Correct 125 ms 5332 KB Output is correct
20 Correct 133 ms 5284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 516 KB Output is correct
2 Correct 114 ms 5328 KB Output is correct
3 Correct 121 ms 5324 KB Output is correct
4 Correct 143 ms 5320 KB Output is correct
5 Correct 133 ms 5292 KB Output is correct
6 Correct 136 ms 5228 KB Output is correct
7 Correct 159 ms 5320 KB Output is correct
8 Correct 123 ms 5528 KB Output is correct
9 Correct 119 ms 5300 KB Output is correct
10 Correct 109 ms 5264 KB Output is correct
11 Correct 119 ms 5304 KB Output is correct
12 Correct 141 ms 5412 KB Output is correct
13 Correct 117 ms 5400 KB Output is correct
14 Correct 121 ms 5292 KB Output is correct
15 Correct 142 ms 5364 KB Output is correct
16 Correct 134 ms 5268 KB Output is correct
17 Correct 117 ms 5256 KB Output is correct
18 Correct 120 ms 5244 KB Output is correct
19 Correct 125 ms 5332 KB Output is correct
20 Correct 133 ms 5284 KB Output is correct
21 Correct 114 ms 5328 KB Output is correct
22 Correct 146 ms 5384 KB Output is correct
23 Correct 121 ms 5324 KB Output is correct
24 Correct 119 ms 5332 KB Output is correct
25 Correct 149 ms 5392 KB Output is correct
26 Correct 123 ms 5408 KB Output is correct
27 Correct 111 ms 5240 KB Output is correct
28 Correct 121 ms 5396 KB Output is correct
29 Correct 124 ms 5216 KB Output is correct
30 Correct 126 ms 5344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 516 KB Output is correct
2 Correct 114 ms 5328 KB Output is correct
3 Correct 121 ms 5324 KB Output is correct
4 Correct 143 ms 5320 KB Output is correct
5 Correct 133 ms 5292 KB Output is correct
6 Correct 136 ms 5228 KB Output is correct
7 Correct 159 ms 5320 KB Output is correct
8 Correct 123 ms 5528 KB Output is correct
9 Correct 119 ms 5300 KB Output is correct
10 Correct 109 ms 5264 KB Output is correct
11 Correct 119 ms 5304 KB Output is correct
12 Correct 141 ms 5412 KB Output is correct
13 Correct 117 ms 5400 KB Output is correct
14 Correct 121 ms 5292 KB Output is correct
15 Correct 142 ms 5364 KB Output is correct
16 Correct 134 ms 5268 KB Output is correct
17 Correct 117 ms 5256 KB Output is correct
18 Correct 120 ms 5244 KB Output is correct
19 Correct 125 ms 5332 KB Output is correct
20 Correct 133 ms 5284 KB Output is correct
21 Correct 114 ms 5328 KB Output is correct
22 Correct 146 ms 5384 KB Output is correct
23 Correct 121 ms 5324 KB Output is correct
24 Correct 119 ms 5332 KB Output is correct
25 Correct 149 ms 5392 KB Output is correct
26 Correct 123 ms 5408 KB Output is correct
27 Correct 111 ms 5240 KB Output is correct
28 Correct 121 ms 5396 KB Output is correct
29 Correct 124 ms 5216 KB Output is correct
30 Correct 126 ms 5344 KB Output is correct
31 Incorrect 123 ms 5300 KB Output isn't correct
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 120 ms 5220 KB Output isn't correct
2 Halted 0 ms 0 KB -