Submission #1114097

# Submission time Handle Problem Language Result Execution time Memory
1114097 2024-11-18T07:47:36 Z Wansur Broken Device 2 (JOI22_device2) C++17
25 / 100
340 ms 19200 KB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

int lg = 60, k = 18;

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(889275928);
    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 = 18;

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(889275928);
    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();
      |         ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 772 KB Output is correct
2 Correct 297 ms 18860 KB Output is correct
3 Correct 286 ms 18828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 772 KB Output is correct
2 Correct 297 ms 18860 KB Output is correct
3 Correct 286 ms 18828 KB Output is correct
4 Correct 291 ms 18856 KB Output is correct
5 Correct 319 ms 19080 KB Output is correct
6 Correct 340 ms 18944 KB Output is correct
7 Correct 298 ms 18856 KB Output is correct
8 Correct 297 ms 18944 KB Output is correct
9 Correct 294 ms 19008 KB Output is correct
10 Correct 292 ms 18860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 772 KB Output is correct
2 Correct 297 ms 18860 KB Output is correct
3 Correct 286 ms 18828 KB Output is correct
4 Correct 291 ms 18856 KB Output is correct
5 Correct 319 ms 19080 KB Output is correct
6 Correct 340 ms 18944 KB Output is correct
7 Correct 298 ms 18856 KB Output is correct
8 Correct 297 ms 18944 KB Output is correct
9 Correct 294 ms 19008 KB Output is correct
10 Correct 292 ms 18860 KB Output is correct
11 Correct 293 ms 18828 KB Output is correct
12 Correct 309 ms 18836 KB Output is correct
13 Correct 294 ms 18940 KB Output is correct
14 Correct 294 ms 18828 KB Output is correct
15 Correct 295 ms 18828 KB Output is correct
16 Correct 300 ms 18916 KB Output is correct
17 Correct 275 ms 18824 KB Output is correct
18 Correct 292 ms 18800 KB Output is correct
19 Correct 297 ms 18920 KB Output is correct
20 Correct 275 ms 18912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 772 KB Output is correct
2 Correct 297 ms 18860 KB Output is correct
3 Correct 286 ms 18828 KB Output is correct
4 Correct 291 ms 18856 KB Output is correct
5 Correct 319 ms 19080 KB Output is correct
6 Correct 340 ms 18944 KB Output is correct
7 Correct 298 ms 18856 KB Output is correct
8 Correct 297 ms 18944 KB Output is correct
9 Correct 294 ms 19008 KB Output is correct
10 Correct 292 ms 18860 KB Output is correct
11 Correct 293 ms 18828 KB Output is correct
12 Correct 309 ms 18836 KB Output is correct
13 Correct 294 ms 18940 KB Output is correct
14 Correct 294 ms 18828 KB Output is correct
15 Correct 295 ms 18828 KB Output is correct
16 Correct 300 ms 18916 KB Output is correct
17 Correct 275 ms 18824 KB Output is correct
18 Correct 292 ms 18800 KB Output is correct
19 Correct 297 ms 18920 KB Output is correct
20 Correct 275 ms 18912 KB Output is correct
21 Correct 274 ms 18828 KB Output is correct
22 Correct 289 ms 18872 KB Output is correct
23 Correct 301 ms 18872 KB Output is correct
24 Correct 305 ms 19048 KB Output is correct
25 Correct 313 ms 18972 KB Output is correct
26 Correct 306 ms 18828 KB Output is correct
27 Correct 287 ms 19200 KB Output is correct
28 Correct 295 ms 18828 KB Output is correct
29 Correct 293 ms 18888 KB Output is correct
30 Correct 302 ms 18944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 772 KB Output is correct
2 Correct 297 ms 18860 KB Output is correct
3 Correct 286 ms 18828 KB Output is correct
4 Correct 291 ms 18856 KB Output is correct
5 Correct 319 ms 19080 KB Output is correct
6 Correct 340 ms 18944 KB Output is correct
7 Correct 298 ms 18856 KB Output is correct
8 Correct 297 ms 18944 KB Output is correct
9 Correct 294 ms 19008 KB Output is correct
10 Correct 292 ms 18860 KB Output is correct
11 Correct 293 ms 18828 KB Output is correct
12 Correct 309 ms 18836 KB Output is correct
13 Correct 294 ms 18940 KB Output is correct
14 Correct 294 ms 18828 KB Output is correct
15 Correct 295 ms 18828 KB Output is correct
16 Correct 300 ms 18916 KB Output is correct
17 Correct 275 ms 18824 KB Output is correct
18 Correct 292 ms 18800 KB Output is correct
19 Correct 297 ms 18920 KB Output is correct
20 Correct 275 ms 18912 KB Output is correct
21 Correct 274 ms 18828 KB Output is correct
22 Correct 289 ms 18872 KB Output is correct
23 Correct 301 ms 18872 KB Output is correct
24 Correct 305 ms 19048 KB Output is correct
25 Correct 313 ms 18972 KB Output is correct
26 Correct 306 ms 18828 KB Output is correct
27 Correct 287 ms 19200 KB Output is correct
28 Correct 295 ms 18828 KB Output is correct
29 Correct 293 ms 18888 KB Output is correct
30 Correct 302 ms 18944 KB Output is correct
31 Correct 302 ms 18828 KB Output is correct
32 Correct 306 ms 18864 KB Output is correct
33 Incorrect 303 ms 18860 KB Output isn't correct
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 319 ms 18828 KB Output is partially correct
2 Partially correct 307 ms 18948 KB Output is partially correct
3 Incorrect 311 ms 18972 KB Output isn't correct
4 Halted 0 ms 0 KB -