Submission #902651

#TimeUsernameProblemLanguageResultExecution timeMemory
902651nguyentunglamBroken Device (JOI17_broken_device)C++17
0 / 100
125 ms3848 KiB
#include "Annalib.h" #include<bits/stdc++.h> using namespace std; //struct encode { void Anna( int n, long long x, int k, int p[] ){ vector<bool> broken(n); cout << x << endl; for(int i = 0; i < n; i++) broken[i] = 0; for(int i = 0; i < k; i++) broken[p[i]] = 1; int j = 59; for(long long i = 0, pre = -1; i < n; i++) { if (broken[i] || j < 0) { Set(i, 0); continue; } bool a = x >> j & 1; bool b = i - pre & 1; if (a == b) { pre = i; j--; Set(i, 1); cout << i << " " << j << " " << a << endl; } else Set(i, 0); } // assert(j < 0); }
#include "Brunolib.h" #include<bits/stdc++.h> using namespace std; //struct decode { long long Bruno( int n, int a[] ){ long long x = 0; for(int i = 0, pre = -1, j = 59; i < n && j >= 0; i++) if (a[i]) { bool bit = i - pre & 1; if (bit) x |= (1LL << j); j--; pre = i; } // for(int i = 0; i < n; i++) cout << a[i] << " "; cout << endl; cout << "answer :" << x << endl; return x; } //}; //decode solve; //long long Bruno( int n, int a[] ){ // return solve.Bruno(n, a); //}

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:19:16: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   19 |     bool b = i - pre & 1;
      |              ~~^~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:9:20: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
    9 |       bool bit = i - pre & 1;
      |                  ~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...