# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
359784 | 2021-01-27T07:56:54 Z | kshitij_sodani | 비교 (balkan11_cmp) | C++14 | 3315 ms | 82556 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; int ind=1; for(int i=0;i<12;i+=2){ int cur=ind; if(n&(1<<i)){ cur+=2; } if(n&(1<<(i+1))){ cur+=1; } bit_set(cur); ind+=4; } /* 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 ind=1; for(int i=0;i<12;i+=2){ int ac=0; if(b&(1<<i)){ ac=2; } int bc=0; if(b&(1<<(i+1))){ bc=1; } if(bit_get(ind+ac+bc)==0){ /*if(bb==1822){ cout<<i<<endl; cout<<ac<<":"<<bc<<endl; }*/ if(bit_get(ind+(ac^2)+(bc))==1){ int cur=(ac^2)+bc; if(cur<ac+bc){ return 1; } return -1; } else if(bit_get(ind+(ac^2)+(bc^1))==1){ int cur=(ac^2)+(bc^1); if(cur<ac+bc){ return 1; } return -1; } else{ int cur=(ac)+(bc^1); if(cur<ac+bc){ return 1; } return -1; } } ind+=4; } return 0; /* 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 3315 ms | 82556 KB | Output is partially correct - maxAccess = 14, score = 64 |