Submission #1143697

#TimeUsernameProblemLanguageResultExecution timeMemory
1143697dpsaveslivesQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++20
100 / 100
833 ms40872 KiB
#include <bits/stdc++.h> using namespace std; int encode(int n, int x, int y){ static vector<int> dp(921); if(dp[0] == 0){ int cur = 0; for (int S = 1; S < (1 << 12) && cur <= 920; ++S) if (__builtin_popcount(S) == 6) dp[++cur] = S; dp[0] = -1; } int ans; for(int k = 0; k < 12; ++k) if((dp[x] & (1 << k)) && !(dp[y] & (1 << k))) ans = k; return ans + 1; }
#include <bits/stdc++.h> using namespace std; int decode(int N, int Q, int H){ static vector<int> dp(921); if(dp[0] == 0){ int cur = 0; for(int S = 1;S < (1<<12) && cur <= 920;++S){ if(__builtin_popcount(S) == 6){ dp[++cur] = S; } } dp[0] = -1; } if(dp[Q]&(1<<(H-1))){ return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...