Submission #1130216

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11302162024-12-27 15:40:09iframe_Snake Escaping (JOI18_snake_escaping)C++20
100 / 100
953 ms28208 KiB
#include <algorithm>
#include <iostream>
int *a[21], d[1<<21];
using ll = long long;
const ll X = (1<<22) - 1;
int res[1000000];
ll b[1000000];
void dfs(int l, int r, int d, int s){
if(!s)
for(; l<r; ++l) res[b[l] & X] = a[d][0];
else{
int s1 = r, s2 = r;
for(int i=r-1; i>=l; --i){
if(((b[i] >> (60-d*2)) & 3) == 2) s2 = s1 = i;
if(((b[i] >> (60-d*2)) & 3) == 1) s1 = i;
}
//std::cout << l << '.' << s1 << '.' << s2 << '.' << r << '\n';
if(l != s1){
for(int i=0; i<s; ++i)
a[d+1][i] = a[d][i];
//std::cout << " -> 0 (" << l << ' ' << s1 << ")\n";
dfs(l, s1, d+1, s/2);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...