# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
359724 | 2021-01-27T07:16:16 Z | kshitij_sodani | cmp (balkan11_cmp) | C++14 | 4100 ms | 104940 KB |
//#pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long long llo; #define mp make_pair #define pb push_back #define endl '\n' #include "cmp.h" void remember(int n) { //edit this int xx=0; for(int i=0;i<12;i++){ if(n&(1<<i)){ xx+=(1<<(11-i)); } } int nn=n; n=xx; //vector<int> aa; int co=0; int ind=0; int pp=0; for(int i=0;i<12;i++){ pp+=(n&(1<<i)); /*if(nn==1023){ cout<<i<<":"<<ind+pp+1<<endl; }*/ bit_set(ind+pp+1); ind+=(1<<(i+1)); } /* if(co<=6){ for(int i=0;i<12;i++){ if(n&(1<<i)){ bit_set(i+2); } else{ } } } else{ bit_set(1); for(int i=0;i<12;i++){ if(n&(1<<i)){ } else{ bit_set(i+2); } } }*/ } bool check(int ind,int b){ int ask=0; for(int i=0;i<ind;i++){ ask+=(b&(1<<i)); } for(int i=0;i<ind-1;i++){ ask+=(1<<(i+1)); } return bit_get(ask+1); } int compare(int b) { //edit this int xx=0; for(int i=0;i<12;i++){ if(b&(1<<i)){ xx+=(1<<(11-i)); } } int bb=b; b=xx; int num=0; int ind=0; for(int i=3;i>=0;i--){ if((ind+(1<<i))>12){ continue; } if(check(ind+(1<<i),b)){ ind+=(1<<i); } } /*if(bb==1268){ cout<<ind<<endl; }*/ if(ind==12){ return 0; } if(b&(1<<ind)){ return 1; } return -1; /*for(int i=2;i<=13;i++){ if(bit_get(i)){ num+=(1<<(i-2)); } } if(bit_get(1)){ num^=4095; } if(num>b){ return -1; } if(num==b){ return 0; }*/ return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 4100 ms | 104940 KB | Output is partially correct - maxAccess = 16, score = 46 |