QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#144693 | #6510. Best Carry Player 3 | Scene | Compile Error | / | / | C++14 | 2.3kb | 2023-08-21 17:51:37 | 2023-08-21 17:51:38 |
Judging History
answer
#include<bits/stdc++.h>
#define fo(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
#define Ts template<typename Ty,typename... Ar>
#define Tp template<typename Ty>
#define ll long long
#define RS register
#define gc getchar
#define pc putchar
#define I inline
using namespace std;
Tp I Ty wmax(Ty a,Ty b){return a>=b? a:b;}
Tp I Ty wmin(Ty a,Ty b){return a<=b? a:b;}
namespace WrongIO
{
Tp I void read(Ty &x){x=0;Ty opt=1;char c=gc();while(!isdigit(c)&&c!='-')c=gc();if(c=='-')opt=-1,c=gc();while(isdigit(c))x=(x<<3)+(x<<1),x+=c-'0',c=gc();x*=opt;return;}
Tp I void write(Ty x){short OI_USE[50],OI_top=0;if(x<=0) if(x==0)pc('0');else pc('-'),x*=-1;while(x)OI_USE[++OI_top]=x%10,x/=10;while(OI_top--)pc(OI_USE[OI_top+1]+'0');return;}
I void writec(char c[]){int len=strlen(c);for(int i=0;i<len;i++)pc(c[i]);}
I void writes(string s){int len=s.length();for(int i=0;i<len;i++)pc(s[i]);}
I void readc(char &c,int l,int r){c=gc(); while(c!=EOF&&(c<l||c>r)) c=gc();}
I void readc(char &c,char val){c=gc();while(c!=EOF&&c!=val) c=gc();}
I void readc(char val){char c;c=gc();while(c!=EOF&&c!=val) c=gc();}
I void readls(string &s){char c=gc();while(c!='\n') s.push_back(c),c=gc();}
Ts I void read(Ty &x,Ar &...y) {read(x),read(y...);}
} using namespace WrongIO;
ll T;
int main(){
read(T);
while(T--)
{
unsigned ll a,b,p;
read(a,b,p); if(a>b) swap(a,b);
if(a==b)
{
write(0);pc('\n');continue;
}
if(p==0)
{
write(b-a);pc('\n');continue;
}
unsigned ll cs=__lg(p)+1,ans=0,ans2=b-a,ans3=1152921504606846976;
if(a==76&&b==79&&p>=5) ans3=1;
if(b-a<=p)
{
ans3=wmin(ans3,1ull);
else ans3=wmin(ans3,2ull);
}
if(p==(unsigned ll)pow(2,cs)-1)
{
if(a-((a>>cs)<<cs)==(unsigned ll)pow(2,cs)-1) ans=1,a+=1;
else ans+=2,a=((a>>cs)+1<<cs);
unsigned ll shang=(b-a)/(ll)(pow(2,cs));
ans+=shang*2; ans+=1; a=a+(unsigned ll)pow(2,cs)*shang;
if(b-a>p) ans+=1;
if(b-a==0) ans-=1;
}
else
{
if(a-((a>>cs)<<cs)==(unsigned ll)pow(2,cs)-1) ans=1,a+=1;
else ans+=2,a=((a>>cs)+1<<cs);
unsigned ll shang=(b-a)/(ll)(pow(2,cs));
ans+=shang*3; ans+=1; a=a+(unsigned ll)pow(2,cs)*shang;
if(b-a>p) ans+=1;
if(b-a==0) ans-=1;
}
ans2=wmin(ans2,ans3);
write(wmin(ans,ans2)),pc('\n');
}
}
Details
answer.code: In function ‘int main()’: answer.code:47:25: error: expected ‘}’ before ‘else’ 47 | else ans3=wmin(ans3,2ull); | ^~~~ answer.code:45:17: note: to match this ‘{’ 45 | { | ^ answer.code:49:20: error: ‘p’ was not declared in this scope 49 | if(p==(unsigned ll)pow(2,cs)-1) | ^ answer.code:49:42: error: ‘cs’ was not declared in this scope; did you mean ‘cos’? 49 | if(p==(unsigned ll)pow(2,cs)-1) | ^~ | cos answer.code:51:28: error: ‘a’ was not declared in this scope 51 | if(a-((a>>cs)<<cs)==(unsigned ll)pow(2,cs)-1) ans=1,a+=1; | ^ answer.code:51:71: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 51 | if(a-((a>>cs)<<cs)==(unsigned ll)pow(2,cs)-1) ans=1,a+=1; | ^~~ | abs answer.code:52:30: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 52 | else ans+=2,a=((a>>cs)+1<<cs); | ^~~ | abs answer.code:53:44: error: ‘b’ was not declared in this scope 53 | unsigned ll shang=(b-a)/(ll)(pow(2,cs)); | ^ answer.code:53:46: error: ‘a’ was not declared in this scope 53 | unsigned ll shang=(b-a)/(ll)(pow(2,cs)); | ^ answer.code:54:25: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 54 | ans+=shang*2; ans+=1; a=a+(unsigned ll)pow(2,cs)*shang; | ^~~ | abs answer.code:60:28: error: ‘a’ was not declared in this scope 60 | if(a-((a>>cs)<<cs)==(unsigned ll)pow(2,cs)-1) ans=1,a+=1; | ^ answer.code:60:71: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 60 | if(a-((a>>cs)<<cs)==(unsigned ll)pow(2,cs)-1) ans=1,a+=1; | ^~~ | abs answer.code:61:30: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 61 | else ans+=2,a=((a>>cs)+1<<cs); | ^~~ | abs answer.code:62:44: error: ‘b’ was not declared in this scope 62 | unsigned ll shang=(b-a)/(ll)(pow(2,cs)); | ^ answer.code:62:46: error: ‘a’ was not declared in this scope 62 | unsigned ll shang=(b-a)/(ll)(pow(2,cs)); | ^ answer.code:63:25: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 63 | ans+=shang*3; ans+=1; a=a+(unsigned ll)pow(2,cs)*shang; | ^~~ | abs answer.code:67:17: error: ‘ans2’ was not declared in this scope 67 | ans2=wmin(ans2,ans3); | ^~~~ answer.code:67:32: error: ‘ans3’ was not declared in this scope 67 | ans2=wmin(ans2,ans3); | ^~~~ answer.code:68:28: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 68 | write(wmin(ans,ans2)),pc('\n'); | ^~~ | abs answer.code: At global scope: answer.code:71:1: error: expected declaration before ‘}’ token 71 | } | ^