Submission #1141759

#TimeUsernameProblemLanguageResultExecution timeMemory
1141759ereringcmp (balkan11_cmp)C++20
0 / 100
410 ms90552 KiB
#include <bits/stdc++.h>
#include "cmp.h"
using namespace std;
#define pb push_back
void remember(int n) {
  int x=1;
  for(int i=1;i<=3;i++){
    int a=n%4;
    n/=4;
    int b=n%4;
    string s="10";
    if(i==2)s[0]='2';
    if(i==3)s[0]='3';
    s+=to_string(b);
    s+=to_string(a);
    a=stoi(s);
    bit_set(a);
    n/=4;
  }
}

int compare(int b) {
  vector<int> v;
  for(int i=1;i<=3;i++){
    int a=b%4;
    b/=4;
    int c=b%4;
    string s="10";
    if(i==2)s[0]='2';
    if(i==3)s[0]='3';
    s+=to_string(c);
    s+=to_string(a);
    a=stoi(s);
    v.pb(a);
    b/=4;
  }
  for(int i=v.size()-1;i>=0;i--){
    int x=v[i],r=bit_get(v[i]);
    if(r==1)continue;
    string s=to_string(x);
    int j=s[2]-'0',k=s[3]-'0';
    if(k+(j-1)*4<3-k+(3-j)*4){
      for(int l=j;l>=0;l--){
        for(int o=(l==j?k-1:3);o>=0;o--){
          string s1="10";
          s1[0]=s[0];
          s1+=to_string(l);
          s1+=to_string(o);
          r=bit_get(stoi(s1));
          if(r)return 1;
        }
      }
      return -1;
    }
    else{
      for(int l=j;l<=3;l++){
        for(int o=(l==j?k+1:0);o<=3;o++){
          string s1="10";
          s1=s[0];
          s1+=to_string(l);
          s1+=to_string(o);
          if(s1=="3031" && b==2980)exit(1);
          r=bit_get(stoi(s1));
          if(r)return -1;
        }
      }
      return 1;
    }
  }
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...