제출 #832342

#제출 시각아이디문제언어결과실행 시간메모리
832342NothingXD죄수들의 도전 (IOI22_prison)C++17
65 / 100
10 ms1108 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; void debug_out(){cerr << endl;} template<typename Head, typename... Tail> void debug_out(Head H, Tail... T){ cerr << H << ' '; debug_out(T...); } #define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__) #define F first #define S second #define all(x) x.begin(), x.end() #define MP(x, y) make_pair(x, y) const int maxn = 25; const int lg = 13; std::vector<std::vector<int>> devise_strategy(int N) { // debug(N); vector<vector<int>> ans; ans.resize(maxn); for (int i = 0; i < maxn; i++){ ans[i].resize(N+1); int bit, val, bag; if (i == 0){ bit = 13; val = 0; bag = 1; } else{ bit = (i+1)/2; val = (i&1); bag = (((i+1)/2)&1); } // debug(i, bit, val, bag); ans[i][0] = bag; /// debug(i, 0, ans[i][0]); for (int j = 1; j <= N; j++){ int tmp = ((j >> bit) & 1); int rem = (1 << bit) - 1; if (tmp < val){ ans[i][j] = -1 - bag; } else if (tmp > val){ ans[i][j] = -1 - (1-bag); } else if ((j & rem) == rem){ ans[i][j] = -1 - (1-bag); } else if ((j & rem) == 0){ ans[i][j] = -1 - bag; } else{ ans[i][j] = (bit-1) * 2 - ((j >> (bit-1)) & 1); } // debug(i, j, ans[i][j]); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...