Submission #1141806

#TimeUsernameProblemLanguageResultExecution timeMemory
1141806ereringcmp (balkan11_cmp)C++20
0 / 100
474 ms94552 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); s="1"; if(i==2)s[0]='2'; if(i==3)s[0]='3'; s+=to_string(b); bit_set(stoi(s)); 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((j-1)+(k-1)<(3-j)+(3-k)){ for(int l=j;l>=0;l--){ for(int o=(l==j?k-1:3);o>=0;o--){ if(l==j) { string s1 = "10"; s1[0] = s[0]; s1 += to_string(l); s1 += to_string(o); r = bit_get(stoi(s1)); if (r)return 1; } else{ string s1; s1+=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++){ if(l==j) { string s1 = "10"; s1[0] = s[0]; s1 += to_string(l); s1 += to_string(o); r = bit_get(stoi(s1)); if (r)return -1; } else{ string s1; s1+=s[0]; s1+=to_string(l); s1+=to_string(o); r=bit_get(stoi(s1)); if(r)return -1; } } } return 1; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...