Submission #351349

#TimeUsernameProblemLanguageResultExecution timeMemory
351349Bill_00Question (Grader is different from the original contest) (CEOI14_question_grader)C++14
0 / 100
13 ms4864 KiB
#include <bits/stdc++.h> #define N 100001 #define MOD 998244353 #define ll long long #define pb push_back const int M=62; using namespace std; int a[1025][1025],o=0; vector<int>v[13][2]; void build(int id,int l,int r,int height){ // cout << l << ' ' << r << '\n'; if(id!=1){ if(id%2==0){ for(int i=l;i<=r;i++){ v[height][0].pb(i); } } else{ for(int i=l;i<=r;i++){ v[height][1].pb(i); } } } if(l==r) return; int m=(l+r)>>1; build(id*2,l,m,height+1); build(id*2+1,m+1,r,height+1); } int encode (int n, int x, int y) { if(o==0){ build(1,1,1024,0); for(int i=1;i<=10;i++){ for(int j:v[i][0]){ for(int k:v[i][1]){ a[j][k]=i; } } } for(int j:v[10][1]){ for(int k:v[10][0]){ a[j][k]=11; } } o++; } return a[x][y]; }
int decode (int n, int q, int h) { if(h!=11){ int k=10-h; k=(1<<k); int d=(q-1)/k; if(d%2==0){ return 1; } else return 0; } else{ if(q%2==0){ return 1; } else return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...