Submission #243097

# Submission time Handle Problem Language Result Execution time Memory
243097 2020-06-30T10:24:19 Z osaaateiasavtnl Broken Device (JOI17_broken_device) C++14
85 / 100
54 ms 3568 KB
#include<bits/stdc++.h>
using namespace std;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';
 
#include "Annalib.h"
 
bool up1[100];
mt19937 rnd1(2007);

void Anna( int N, long long X, int K, int P[] ){

    for (int i = 0; i < 100; ++i)
        up1[i] = rnd1()&1;
    
    /*
    for (int i = 0; i < 10; ++i)
        cout << up1[i];
    cout << endl;            
    */

    vector <int> tri;
    while (X) {
        tri.app(X%3);
        X /= 3;        
    }
 
    reverse(all(tri));
 
    vector <bool> used(N);
    for (int i = 0; i < K; ++i)
        used[P[i]] = 1;
 
    /*
    cout << "tri : ";
    for (auto e : tri)
        cout << e << ' ';
    cout << endl;
    */
 
    int i = 0, ptr = 0;
    while (i + 1 < N) {
        auto check = [&]() {
            if (ptr == tri.size())
                return false;
            int x = tri[ptr]+1;
            if (up1[ptr])
                x = 4 - x;
            return (!used[i] || !(x&1)) && (!used[i+1] || !((x >> 1) & 1));
        };
        if (check()) {
            int x = tri[ptr]+1;
            if (up1[ptr])
                x = 4 - x;
            ++ptr;

            Set(i, x & 1);
            Set(i + 1, (x >> 1) & 1);
        }   
        else {
            Set(i, 0);
            Set(i + 1, 0);
        }   
        i += 2;
    }   
}
#include<bits/stdc++.h>
using namespace std;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';
 
#include "Brunolib.h"

bool up2[100];
mt19937 rnd2(2007);
 
long long Bruno( int N, int A[] ){

    for (int i = 0; i < 100; ++i)
        up2[i] = rnd2()&1;

    /*
    for (int i = 0; i < 10; ++i)
        cout << up2[i];
    cout << endl;            
    */

    ll ans = 0;
    int ptr = 0;
    for (int i = 0; i < N; i += 2) {
        int add = A[i] + (A[i+1]<<1);
        if (add) {

            if (up2[ptr]) {
                add = 4 - add;
            }   
            ++ptr;

            --add;
            ans = ans * 3 + add;
        }   
    }
    return ans;
}

Compilation message

Anna.cpp: In lambda function:
Anna.cpp:52:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (ptr == tri.size())
                 ~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 48 ms 3312 KB Output is partially correct - L* = 37
2 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
3 Partially correct 53 ms 3312 KB Output is partially correct - L* = 37
4 Partially correct 53 ms 3328 KB Output is partially correct - L* = 37
5 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
6 Partially correct 50 ms 3312 KB Output is partially correct - L* = 37
7 Partially correct 53 ms 3328 KB Output is partially correct - L* = 37
8 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
9 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
10 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
11 Partially correct 53 ms 3328 KB Output is partially correct - L* = 37
12 Partially correct 48 ms 3328 KB Output is partially correct - L* = 37
13 Partially correct 50 ms 3328 KB Output is partially correct - L* = 37
14 Partially correct 49 ms 3312 KB Output is partially correct - L* = 37
15 Partially correct 50 ms 3312 KB Output is partially correct - L* = 37
16 Partially correct 51 ms 3312 KB Output is partially correct - L* = 37
17 Partially correct 51 ms 3328 KB Output is partially correct - L* = 37
18 Partially correct 49 ms 3312 KB Output is partially correct - L* = 37
19 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
20 Partially correct 48 ms 3568 KB Output is partially correct - L* = 37
21 Partially correct 50 ms 3328 KB Output is partially correct - L* = 37
22 Partially correct 47 ms 3328 KB Output is partially correct - L* = 37
23 Partially correct 50 ms 3568 KB Output is partially correct - L* = 37
24 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
25 Partially correct 51 ms 3328 KB Output is partially correct - L* = 37
26 Partially correct 48 ms 3312 KB Output is partially correct - L* = 37
27 Partially correct 53 ms 3344 KB Output is partially correct - L* = 37
28 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
29 Partially correct 54 ms 3312 KB Output is partially correct - L* = 37
30 Partially correct 50 ms 3312 KB Output is partially correct - L* = 37
31 Partially correct 48 ms 3328 KB Output is partially correct - L* = 38
32 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
33 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
34 Partially correct 48 ms 3328 KB Output is partially correct - L* = 37
35 Partially correct 49 ms 3312 KB Output is partially correct - L* = 37
36 Partially correct 49 ms 3312 KB Output is partially correct - L* = 37
37 Partially correct 50 ms 3312 KB Output is partially correct - L* = 37
38 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37
39 Partially correct 50 ms 3344 KB Output is partially correct - L* = 37
40 Partially correct 49 ms 3328 KB Output is partially correct - L* = 37