답안 #1114093

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1114093 2024-11-18T07:42:59 Z Wansur Broken Device 2 (JOI22_device2) C++17
60 / 100
382 ms 22052 KB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

int lg = 60, k = 21;

int Declare() {
    return lg * (k + 1);
}

pair<vector<int>, vector<int>> Anna(long long x) {
    vector<int> a, b;
    a.push_back(1);
    vector<int> p(lg);
    for(int i = 0; i < lg; i++) {
        p[i] = i;
    }
    mt19937 rng(59493542);
    shuffle(p.begin(), p.end(), rng);
    for(int i : p) {
        int t = ((x >> i) & 1);
        for(int j = 0; j < k; j++){
            a.push_back(t);
        }
        a.push_back(1);
    }
    a.pop_back();
    while(b.size() < a.size()) {
        b.push_back(0);
    }
    return {a, b};
}
#include "Bruno.h"
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int tk = 21;

long long Bruno(vector<int> u) {
    int n = (int) u.size();
    ll ans = 0, b = 0;
    vector<int> p(60);
    for(int i = 0; i < 60; i++) {
        p[i] = i;
    }
    mt19937 rng(59493542);
    shuffle(p.begin(), p.end(), rng);
    for(int i = 0; i + 1 < (int)u.size(); i++) {
        if(u[i] == 0) {
            continue;
        }
        int fg = 0;
        for(int j = i + 1; j <= i + tk; j++) {
            fg |= u[j];
        }
        if(fg) {
            ans |= (1ll << p[b]);
            int cnt = 0, j = i;
            while(cnt < tk) {
                j++;
                cnt += u[j];
            }
            i = j;
        }
        b++;
    }
    return ans;
}

Compilation message

Bruno.cpp: In function 'long long int Bruno(std::vector<int>)':
Bruno.cpp:10:9: warning: unused variable 'n' [-Wunused-variable]
   10 |     int n = (int) u.size();
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 828 KB Output is correct
2 Correct 344 ms 21736 KB Output is correct
3 Correct 341 ms 21728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 828 KB Output is correct
2 Correct 344 ms 21736 KB Output is correct
3 Correct 341 ms 21728 KB Output is correct
4 Correct 337 ms 21752 KB Output is correct
5 Correct 345 ms 21800 KB Output is correct
6 Correct 337 ms 21728 KB Output is correct
7 Correct 347 ms 21860 KB Output is correct
8 Correct 332 ms 21604 KB Output is correct
9 Correct 338 ms 21648 KB Output is correct
10 Correct 308 ms 21632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 828 KB Output is correct
2 Correct 344 ms 21736 KB Output is correct
3 Correct 341 ms 21728 KB Output is correct
4 Correct 337 ms 21752 KB Output is correct
5 Correct 345 ms 21800 KB Output is correct
6 Correct 337 ms 21728 KB Output is correct
7 Correct 347 ms 21860 KB Output is correct
8 Correct 332 ms 21604 KB Output is correct
9 Correct 338 ms 21648 KB Output is correct
10 Correct 308 ms 21632 KB Output is correct
11 Correct 333 ms 21824 KB Output is correct
12 Correct 343 ms 21728 KB Output is correct
13 Correct 334 ms 21964 KB Output is correct
14 Correct 327 ms 21608 KB Output is correct
15 Correct 314 ms 21696 KB Output is correct
16 Correct 311 ms 21628 KB Output is correct
17 Correct 287 ms 21728 KB Output is correct
18 Correct 309 ms 21632 KB Output is correct
19 Correct 310 ms 21736 KB Output is correct
20 Correct 309 ms 21728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 828 KB Output is correct
2 Correct 344 ms 21736 KB Output is correct
3 Correct 341 ms 21728 KB Output is correct
4 Correct 337 ms 21752 KB Output is correct
5 Correct 345 ms 21800 KB Output is correct
6 Correct 337 ms 21728 KB Output is correct
7 Correct 347 ms 21860 KB Output is correct
8 Correct 332 ms 21604 KB Output is correct
9 Correct 338 ms 21648 KB Output is correct
10 Correct 308 ms 21632 KB Output is correct
11 Correct 333 ms 21824 KB Output is correct
12 Correct 343 ms 21728 KB Output is correct
13 Correct 334 ms 21964 KB Output is correct
14 Correct 327 ms 21608 KB Output is correct
15 Correct 314 ms 21696 KB Output is correct
16 Correct 311 ms 21628 KB Output is correct
17 Correct 287 ms 21728 KB Output is correct
18 Correct 309 ms 21632 KB Output is correct
19 Correct 310 ms 21736 KB Output is correct
20 Correct 309 ms 21728 KB Output is correct
21 Correct 329 ms 21872 KB Output is correct
22 Correct 349 ms 21716 KB Output is correct
23 Correct 329 ms 22012 KB Output is correct
24 Correct 345 ms 21752 KB Output is correct
25 Correct 335 ms 21608 KB Output is correct
26 Correct 343 ms 21988 KB Output is correct
27 Correct 322 ms 21728 KB Output is correct
28 Correct 336 ms 21716 KB Output is correct
29 Correct 331 ms 21932 KB Output is correct
30 Correct 368 ms 21760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 828 KB Output is correct
2 Correct 344 ms 21736 KB Output is correct
3 Correct 341 ms 21728 KB Output is correct
4 Correct 337 ms 21752 KB Output is correct
5 Correct 345 ms 21800 KB Output is correct
6 Correct 337 ms 21728 KB Output is correct
7 Correct 347 ms 21860 KB Output is correct
8 Correct 332 ms 21604 KB Output is correct
9 Correct 338 ms 21648 KB Output is correct
10 Correct 308 ms 21632 KB Output is correct
11 Correct 333 ms 21824 KB Output is correct
12 Correct 343 ms 21728 KB Output is correct
13 Correct 334 ms 21964 KB Output is correct
14 Correct 327 ms 21608 KB Output is correct
15 Correct 314 ms 21696 KB Output is correct
16 Correct 311 ms 21628 KB Output is correct
17 Correct 287 ms 21728 KB Output is correct
18 Correct 309 ms 21632 KB Output is correct
19 Correct 310 ms 21736 KB Output is correct
20 Correct 309 ms 21728 KB Output is correct
21 Correct 329 ms 21872 KB Output is correct
22 Correct 349 ms 21716 KB Output is correct
23 Correct 329 ms 22012 KB Output is correct
24 Correct 345 ms 21752 KB Output is correct
25 Correct 335 ms 21608 KB Output is correct
26 Correct 343 ms 21988 KB Output is correct
27 Correct 322 ms 21728 KB Output is correct
28 Correct 336 ms 21716 KB Output is correct
29 Correct 331 ms 21932 KB Output is correct
30 Correct 368 ms 21760 KB Output is correct
31 Correct 346 ms 21856 KB Output is correct
32 Correct 340 ms 21668 KB Output is correct
33 Correct 337 ms 21608 KB Output is correct
34 Correct 336 ms 21744 KB Output is correct
35 Correct 335 ms 22052 KB Output is correct
36 Correct 324 ms 21732 KB Output is correct
37 Correct 310 ms 21736 KB Output is correct
38 Correct 329 ms 21692 KB Output is correct
39 Correct 319 ms 21724 KB Output is correct
40 Correct 321 ms 21668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 318 ms 21632 KB Output is partially correct
2 Partially correct 319 ms 22012 KB Output is partially correct
3 Partially correct 320 ms 21636 KB Output is partially correct
4 Partially correct 326 ms 21628 KB Output is partially correct
5 Partially correct 344 ms 21724 KB Output is partially correct
6 Partially correct 354 ms 21604 KB Output is partially correct
7 Partially correct 345 ms 21852 KB Output is partially correct
8 Partially correct 356 ms 21724 KB Output is partially correct
9 Partially correct 382 ms 21756 KB Output is partially correct
10 Partially correct 336 ms 21848 KB Output is partially correct
11 Partially correct 352 ms 21812 KB Output is partially correct
12 Partially correct 382 ms 21788 KB Output is partially correct
13 Partially correct 340 ms 21724 KB Output is partially correct
14 Partially correct 334 ms 21600 KB Output is partially correct
15 Partially correct 348 ms 21612 KB Output is partially correct
16 Partially correct 350 ms 21700 KB Output is partially correct
17 Partially correct 362 ms 21984 KB Output is partially correct
18 Partially correct 338 ms 21720 KB Output is partially correct
19 Partially correct 368 ms 21884 KB Output is partially correct
20 Partially correct 347 ms 21600 KB Output is partially correct