Submission #744730

#TimeUsernameProblemLanguageResultExecution timeMemory
744730jiahngPrisoner Challenge (IOI22_prison)C++17
38 / 100
19 ms1616 KiB
#include "prison.h" #include <vector> #include <bits/stdc++.h> using namespace std; typedef long long ll; //~ #define ll int typedef long double ld; typedef pair<int, int> pi; typedef vector<int> vi; typedef vector<pi> vpi; typedef pair<pi, ll> pii; typedef set<ll> si; typedef long double ld; #define f first #define s second #define mp make_pair #define FOR(i, s, e) for (int i = s; i <= int(e); ++i) #define DEC(i, s, e) for (int i = s; i >= int(e); --i) #define pb push_back #define all(x) (x).begin(), (x).end() #define lbd(x, y) lower_bound(all(x), y) #define ubd(x, y) upper_bound(all(x), y) #define aFOR(i, x) for (auto i : x) #define mem(x, i) memset(x, i, sizeof x) #define fast ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define maxn 200010 #define INF (ll)1e18 #define MOD 998244353 typedef pair<vi, int> pvi; typedef pair<int, pi> ipi; typedef vector<pii> vpii; #define DEBUG 0 typedef pair <pi,pi> pipi; typedef vector <pipi> vpipi; typedef pair <string, int> psi; std::vector<std::vector<int>> devise_strategy(int N) { vector <vi> ans; // a = 0 : last B // a = 1 : last A, off // a = 2 : last A, on FOR(a,0,2) FOR(k,0,12){ vi res(N+1); res[0] = (a != 0); // B if bit is on //~ assert(ans.size() == k+12*a); FOR(x,1,N){ if ((1<<(12-k))&x){ if (a != 0){ // last was A, compare if (a == 1){ // B is bigger res[x] = -1; }else{ // bit is same int k2 = k+1; int a2 = 0; res[x] = k2+13*a2; } }else{ // last was B int a2 = 2; res[x] = k+13*a2; } }else{ if (a != 0){ // last was A, compare if (a == 2){ // A is bigger res[x] = -2; }else{ int k2 = k+1; int a2 = 0; res[x] = k2+13*a2; } }else{ // last was B int a2 = 1; res[x] = k + 13*a2; } } } //~ aFOR(j, res) assert(j <= 26); ans.pb(res); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...