Submission #243066

# Submission time Handle Problem Language Result Execution time Memory
243066 2020-06-30T08:57:52 Z osaaateiasavtnl Broken Device (JOI17_broken_device) C++14
0 / 100
71 ms 3392 KB
#include "Annalib.h"
#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

mt19937 rnd1(2007);
void Anna( int N, long long X, int K, int P[] ){
    vector <bool> used(N);
    for (int i = 0; i < K; ++i)
        used[P[i]] = 1;
    vector <int> can;
    for (int i = 0; i < N; ++i)
        if (!used[i])   
            can.app(i);
 
    int ptr = 0;
    vector <bool> ans(N), ans1(N);
    for (int bit = 0; bit < 60; ++bit) {
        int w = (X >> bit) & 1;
        while (ptr < can.size() && (can[ptr]&1) != w) {
            ++ptr;
        }   
 
        if (ptr == can.size()) {
            //cout << "gg" << endl;
            for (int i = 0; i < N; ++i) 
                Set(i, 0);
            return;
        }   
 
        ans[can[ptr]] = 1;
        ++ptr;
    }   

    vector <int> per;
    for (int i = 0; i < N; ++i)
        per.app(i);
    shuffle(all(per), rnd1);

    for (int i = 0; i < N; ++i) {
        ans1[per[i]] = ans[i];
    }       

    for (int i = 0; i < N; ++i) {
        Set(i, ans1[i]);
    }   
}
#include "Brunolib.h"
#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
 
mt19937 rnd2(2007);
long long Bruno( int N, int A[] ){

    vector <int> per;
    for (int i = 0; i < N; ++i)
        per.app(i);
    shuffle(all(per), rnd2);    

    vector <int> t(N);
    for (int i = 0; i < N; ++i) {
        t[i] = A[per[i]];
    }   
    for (int i = 0; i < N; ++i)
        A[i] = t[i];

    vector <int> pos;
    for (int i = 0; i < N; ++i)
        if (A[i])
            pos.app(i);
 
    long long ans = 0;
    for (int i = 0; i < pos.size(); ++i) {
        if (pos[i]&1) {
            ans += 1ll << i;
        }   
    }    
    return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while (ptr < can.size() && (can[ptr]&1) != w) {
                ~~~~^~~~~~~~~~~~
Anna.cpp:33:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (ptr == can.size()) {
             ~~~~^~~~~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:36:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < pos.size(); ++i) {
                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 63 ms 3312 KB Output isn't correct - L* = 0
2 Partially correct 60 ms 3312 KB Output isn't correct - L* = 0
3 Partially correct 57 ms 3328 KB Output isn't correct - L* = 0
4 Partially correct 59 ms 3312 KB Output isn't correct - L* = 0
5 Partially correct 59 ms 3296 KB Output isn't correct - L* = 0
6 Partially correct 59 ms 3312 KB Output isn't correct - L* = 0
7 Partially correct 61 ms 3320 KB Output isn't correct - L* = 0
8 Partially correct 62 ms 3312 KB Output isn't correct - L* = 0
9 Partially correct 59 ms 3312 KB Output isn't correct - L* = 0
10 Partially correct 64 ms 3312 KB Output isn't correct - L* = 0
11 Partially correct 63 ms 3312 KB Output isn't correct - L* = 0
12 Partially correct 59 ms 3328 KB Output isn't correct - L* = 0
13 Partially correct 56 ms 3392 KB Output isn't correct - L* = 0
14 Partially correct 57 ms 3328 KB Output isn't correct - L* = 0
15 Partially correct 62 ms 3312 KB Output isn't correct - L* = 0
16 Partially correct 67 ms 3328 KB Output isn't correct - L* = 0
17 Partially correct 60 ms 3160 KB Output isn't correct - L* = 0
18 Partially correct 71 ms 3312 KB Output isn't correct - L* = 0
19 Partially correct 56 ms 3328 KB Output isn't correct - L* = 0
20 Partially correct 59 ms 3328 KB Output isn't correct - L* = 0
21 Partially correct 62 ms 3312 KB Output isn't correct - L* = 0
22 Partially correct 57 ms 3312 KB Output isn't correct - L* = 0
23 Partially correct 61 ms 3312 KB Output isn't correct - L* = 0
24 Partially correct 57 ms 3328 KB Output isn't correct - L* = 0
25 Partially correct 59 ms 3312 KB Output isn't correct - L* = 0
26 Partially correct 57 ms 3328 KB Output isn't correct - L* = 0
27 Partially correct 61 ms 3328 KB Output isn't correct - L* = 0
28 Partially correct 63 ms 3312 KB Output isn't correct - L* = 0
29 Partially correct 57 ms 3312 KB Output isn't correct - L* = 0
30 Partially correct 55 ms 3328 KB Output isn't correct - L* = 0
31 Partially correct 60 ms 3312 KB Output isn't correct - L* = 0
32 Partially correct 63 ms 3312 KB Output isn't correct - L* = 0
33 Partially correct 59 ms 3312 KB Output isn't correct - L* = 0
34 Partially correct 56 ms 3312 KB Output isn't correct - L* = 0
35 Partially correct 56 ms 3328 KB Output isn't correct - L* = 0
36 Partially correct 56 ms 3328 KB Output isn't correct - L* = 0
37 Partially correct 59 ms 3320 KB Output isn't correct - L* = 0
38 Partially correct 55 ms 3312 KB Output isn't correct - L* = 0
39 Partially correct 59 ms 3280 KB Output isn't correct - L* = 0
40 Partially correct 59 ms 3312 KB Output isn't correct - L* = 0