제출 #642026

#제출 시각아이디문제언어결과실행 시간메모리
642026Vanilla죄수들의 도전 (IOI22_prison)C++17
10 / 100
6 ms596 KiB
#include <bits/stdc++.h> #include "prison.h" using namespace std; vector<vector<int>> devise_strategy(int N) { vector <vector <int> > rs (25, vector <int> (N + 1, 0)); rs[0][0] = 0; for (int i = 1; i <= N; i++){ rs[0][i] = ((i & (1 << 12)) ? 2: 1); } for (int i = 1, bit = 12; i <= 24; i++){ int open = ((i + 1) / 2) % 2; rs[i][0] = open; // cout << i << " " << bit << "\n"; if (i % 2 == 1) { // bit unset for (int j = 1; j <= N; j++){ if (j & (1 << (bit - 1))){ rs[i][j] = -(!open) - 1; } else { if (j & (1 << (bit - 2))) { rs[i][j] = i + 3; } else rs[i][j] = i + 2; } } } else { for (int j = 1; j <= N; j++){ // bit set // clog << "> " << j << "\n"; if (j & (1 << (bit - 1))) { if (j & (1 << (bit - 2))) { rs[i][j] = i + 2; } else rs[i][j] = i + 1; } else { rs[i][j] = -open - 1; } } bit--; } } for (int i = 0; i < 25; i++){ for (int j = 0; j < N + 1; j++){ if (rs[i][j] > 24) rs[i][j] = -1; } // cout << "\n"; } return rs; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...