제출 #630093

#제출 시각아이디문제언어결과실행 시간메모리
630093CyanForces죄수들의 도전 (IOI22_prison)C++17
0 / 100
787 ms2097152 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define trav(a, x) for(auto& a : x) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; int** devise_strategy(int N) { int maxX = 35; int** retvalue = new int*[maxX]; rep(i,0,maxX) { retvalue[i] = new int[N+1]; rep(j,0,N+1) retvalue[i][j] = 0; } bool checkB = true; int lenInterval = 4096; retvalue[0][0] = 0; rep(i,1,N+1) { retvalue[0][i] = 1 + i / lenInterval; } int p = 2; while(lenInterval != 1) { rep(prev,p*2-3,p*2-1) { int wasLowInterval = (prev&1) == 0; retvalue[prev][0] = checkB; rep(resp,1,N+1) { int temp = resp % (2*lenInterval); int isLowInterval = temp < lenInterval; if (wasLowInterval != isLowInterval) { // we know the answer if (wasLowInterval) { // the answer is in the current thing that was opened retvalue[prev][resp] = -1-checkB; } else { // the answer is in the opposite of what was opened retvalue[prev][resp] = -1-(1-checkB); } continue; } temp = resp % lenInterval; int newIntervalLen = lenInterval / 2; int isHiInterval = temp >= newIntervalLen; retvalue[prev][resp] = p*2-1 + isHiInterval; } } p++; lenInterval /= 2; checkB = !checkB; } return retvalue; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...