Submission #61224

#TimeUsernameProblemLanguageResultExecution timeMemory
61224gs14004Broken Device (JOI17_broken_device)C++17
100 / 100
86 ms3944 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; int seq[222]; int chk[222]; void Embed(int pos, int val){ Set(pos, val >> 2); Set(pos + 1, (val >> 1) & 1); Set(pos + 2, val & 1); } void Anna( int N, long long X, int K, int P[] ){ for(int i=0; i<60; i++){ seq[i] = (X >> i) & 1; } for(int i=0; i<150; i++) chk[i] = 1; for(int i=0; i<K; i++){ chk[P[i]] = 0; } int ptr = 0; for(int i=0; i<150; i+=3){ if(chk[i] + chk[i+1] + chk[i+2] <= 1){ Embed(i, 0); } else if(chk[i] + chk[i+1] + chk[i+2] == 3){ if(seq[ptr] == 0 && seq[ptr+1] == 0){ Embed(i, 4); } else if(seq[ptr] == 0 && seq[ptr+1] == 1){ Embed(i, 6); } else if(seq[ptr] == 1 & seq[ptr+1] == 0){ Embed(i, 3); } else{ Embed(i, 7); } ptr += 2; } else{ if(seq[ptr] == 0){ if(chk[i+2] == 1){ Embed(i, 1); ptr++; } else{ if(seq[ptr+1] == 0){ Embed(i, 4); } else{ Embed(i, 6); } ptr += 2; } } else{ if(chk[i+1] == 0) Embed(i, 5); else Embed(i, 2); ptr++; } } } }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; long long Bruno( int N, int A[] ){ vector<int> ans; for(int i=0; i<150; i+=3){ int val = (A[i] << 2) | (A[i+1] << 1) | (A[i+2]); if(val == 1){ ans.push_back(0); } if(val == 2){ ans.push_back(1); } if(val == 3){ ans.push_back(1); ans.push_back(0); } if(val == 4){ ans.push_back(0); ans.push_back(0); } if(val == 5){ ans.push_back(1); } if(val == 6){ ans.push_back(0); ans.push_back(1); } if(val == 7){ ans.push_back(1); ans.push_back(1); } } long long dap = 0; assert(ans.size() >= 60); for(int i=0; i<60; i++){ if(ans[i]) dap |= (1ll << i); } return dap; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:34:21: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
    else if(seq[ptr] == 1 & seq[ptr+1] == 0){
            ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...