Submission #730310

#TimeUsernameProblemLanguageResultExecution timeMemory
730310ismayilPrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms212 KiB
#pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #define endl '\n' using namespace std; int count(int n){ int ans = 0, m = 1; while(m <= n) m *= 2, ans++; return ans; } vector<vector<int>> devise_strategy(int N) { int lg = count(N); vector<vector<int>> s(27, vector<int>(N + 1, 0)); for(int i = 0; i <= 26; i++){ int d = i / 2; int bit = i % 2; if(d % 2 == 0) s[i][0] = 0; else s[i][0] = 1; for(int j = 1; j <= N; j++){ int _bit = (j & (1<<(12 - d))); if(bit < _bit){ if(d % 2 == 0) s[i][j] = -2; else s[i][j] = -1; }else if(bit > _bit){ if(d % 2 == 0) s[i][j] = -1; else s[i][j] = -2; }else if(d == 13){ s[i][j] = -1; }else{ s[i][j] = (d + 1) * 2 + __builtin_popcount((j & (1<<(12 - (d + 1))))); } } } return s; }

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:11:9: warning: unused variable 'lg' [-Wunused-variable]
   11 |     int lg = count(N);
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...