Submission #100081

# Submission time Handle Problem Language Result Execution time Memory
100081 2019-03-09T08:18:09 Z helloworldworld Broken Device (JOI17_broken_device) C++14
0 / 100
30 ms 904 KB
#include "Annalib.h"

void Anna( int n, long long x, int k, int p[] ){
    int num[65];
    int c=0;
    int s,e;
    while(x!=0){
        num[c]=x%2;
        x/=2;
        c++;
    }
    int cur=0;
    for(int i=0;i<k&&cur<c;i++){
        if(i==0) s=0;
        else s=p[i-1]+1;
        e=p[i];
        Set(e,0);
        if(e-s<1) continue;
        if(e-s==1){
            if(num[cur]==1){
                Set(s,1);
                s++;
            }
            else{
                Set(s,0);
                s++;
            }
        }
        else{
            while(e-s>=2-num[cur]&&cur<c){
                if(num[cur]==0){
                    Set(s,1);
                    Set(s+1,1);
                    s+=2;
                    cur++;
                }
                else if(num[cur]==1){
                    Set(s,1);
                    s++;
                    cur++;
                }
            }
            if(e-s==1)
                Set(s,0);
        }

    }
    int now;
    
    return;
}

#include "Brunolib.h"

long long Bruno( int n, int a[] ){
    long long ans=0;
    long long p=1;
    for(int i=0;i<n;i++){
        if(a[i]==1){
            if(i<n-1){
                if(a[i+1]==1){
                    ans+=0;
                    p*=2;
                    i++;
                }
                else{
                    ans+=p;
                    p*=2;
                }
            }
            else{
                ans+=p;
                p*=2;
            }
        }
    }
    return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:48:9: warning: unused variable 'now' [-Wunused-variable]
     int now;
         ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 776 KB Wrong Answer [4]
2 Incorrect 4 ms 896 KB Wrong Answer [4]
3 Incorrect 6 ms 768 KB Wrong Answer [4]
4 Incorrect 5 ms 904 KB Wrong Answer [4]
5 Incorrect 7 ms 904 KB Wrong Answer [4]
6 Incorrect 5 ms 904 KB Wrong Answer [4]
7 Incorrect 4 ms 640 KB Wrong Answer [4]
8 Incorrect 4 ms 700 KB Wrong Answer [4]
9 Incorrect 4 ms 776 KB Wrong Answer [4]
10 Incorrect 6 ms 804 KB Wrong Answer [4]
11 Incorrect 6 ms 768 KB Wrong Answer [4]
12 Incorrect 4 ms 664 KB Wrong Answer [4]
13 Incorrect 4 ms 776 KB Wrong Answer [4]
14 Incorrect 5 ms 640 KB Wrong Answer [4]
15 Incorrect 6 ms 776 KB Wrong Answer [4]
16 Incorrect 4 ms 768 KB Wrong Answer [4]
17 Incorrect 4 ms 640 KB Wrong Answer [4]
18 Incorrect 4 ms 668 KB Wrong Answer [4]
19 Incorrect 4 ms 640 KB Wrong Answer [4]
20 Incorrect 4 ms 892 KB Wrong Answer [4]
21 Incorrect 5 ms 640 KB Wrong Answer [4]
22 Incorrect 4 ms 640 KB Wrong Answer [4]
23 Incorrect 4 ms 776 KB Wrong Answer [4]
24 Incorrect 4 ms 640 KB Wrong Answer [4]
25 Incorrect 4 ms 776 KB Wrong Answer [4]
26 Incorrect 4 ms 776 KB Wrong Answer [4]
27 Incorrect 4 ms 768 KB Wrong Answer [4]
28 Incorrect 4 ms 768 KB Wrong Answer [4]
29 Incorrect 4 ms 640 KB Wrong Answer [4]
30 Incorrect 5 ms 776 KB Wrong Answer [4]
31 Incorrect 4 ms 648 KB Wrong Answer [4]
32 Incorrect 6 ms 768 KB Wrong Answer [4]
33 Incorrect 5 ms 768 KB Wrong Answer [4]
34 Incorrect 4 ms 672 KB Wrong Answer [4]
35 Incorrect 5 ms 776 KB Wrong Answer [4]
36 Incorrect 4 ms 640 KB Wrong Answer [4]
37 Incorrect 5 ms 640 KB Wrong Answer [4]
38 Incorrect 30 ms 688 KB Wrong Answer [4]
39 Incorrect 5 ms 748 KB Wrong Answer [4]
40 Incorrect 5 ms 896 KB Wrong Answer [4]