# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1260876 | user736482 | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++20 | 3 ms | 4160 KiB |
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define INF 1000000019
#define POT (1<<20)
#define INFL 1000000000000000099
ll a,b,c,n,t;
vector<vector<ll>>cs={{1,2,3,4,5,0},{1,4,5,2,3,0},{0,4,2,1,3,5},{0,5,3,1,2,4}};
vector<ll>roz[921];
int encode(int n,int a,int b){
for(ll i=0;i<920;i++){
ll x=6*6*6;
ll o=i;
for(ll j=0;j<4;j++){
roz[i].pb(o/x);
o%=x;
x/=6;
}
}
ll j;
for(j=0;roz[a][j]==roz[b][j];j++);
//cout<<j<<" ";
ll x;
for(x=0;x<4;x++){
if((cs[x][0]==roz[a][j] || cs[x][1]==roz[a][j] || cs[x][2]==roz[a][j])&&(cs[x][3]==roz[b][j] || cs[x][4]==roz[b][j] || cs[x][5]==roz[b][j]))break;
}
return 4*j+x+1;
}
int decode(int n,int a,int b){
for(ll i=0;i<920;i++){
ll x=6*6*6;
ll o=i;
for(ll j=0;j<4;j++){
roz[i].pb(o/x);
o%=x;
x/=6;
}
}
b--;
ll j=b/4;
ll x=b%4;
if(cs[x][0]==roz[a][j] || cs[x][1]==roz[a][j] || cs[x][2]==roz[a][j])return 1;
return 0;
}
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define INF 1000000019
#define POT (1<<20)
#define INFL 1000000000000000099
ll a,b,c,n,t;
vector<vector<ll>>cs={{1,2,3,4,5,0},{1,4,5,2,3,0},{0,4,2,1,3,5},{0,5,3,1,2,4}};
vector<ll>roz[921];
int encode(int n,int a,int b){
for(ll i=0;i<920;i++){
ll x=6*6*6;
ll o=i;
for(ll j=0;j<4;j++){
roz[i].pb(o/x);
o%=x;
x/=6;
}
}
ll j;
for(j=0;roz[a][j]==roz[b][j];j++);
//cout<<j<<" ";
ll x;
for(x=0;x<4;x++){
if((cs[x][0]==roz[a][j] || cs[x][1]==roz[a][j] || cs[x][2]==roz[a][j])&&(cs[x][3]==roz[b][j] || cs[x][4]==roz[b][j] || cs[x][5]==roz[b][j]))break;
}
return 4*j+x+1;
}
int decode(int n,int a,int b){
for(ll i=0;i<920;i++){
ll x=6*6*6;
ll o=i;
for(ll j=0;j<4;j++){
roz[i].pb(o/x);
o%=x;
x/=6;
}
}
b--;
ll j=b/4;
ll x=b%4;
if(cs[x][0]==roz[a][j] || cs[x][1]==roz[a][j] || cs[x][2]==roz[a][j])return 1;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |