Submission #243093

# Submission time Handle Problem Language Result Execution time Memory
243093 2020-06-30T10:12:05 Z osaaateiasavtnl Broken Device (JOI17_broken_device) C++14
0 / 100
6 ms 512 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"
 
void Anna( int N, long long X, int K, int P[] ){
    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) {
        int x = tri[ptr]+1;
        if ((!used[i] || !(x&1)) && (!used[i+1] || !((x >> 1) & 1)) && ptr < tri.size()) {
            ++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"
 
long long Bruno( int N, int A[] ){
    ll ans = 0;
    for (int i = 0; i < N; i += 2) {
        int add = A[i] + (A[i+1]<<1);
        if (add) {
            --add;
            ans = ans * 3 + add;
        }   
    }
    return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:39:76: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if ((!used[i] || !(x&1)) && (!used[i+1] || !((x >> 1) & 1)) && ptr < tri.size()) {
                                                                        ~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 6 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)