Borderou de evaluare (job #2590349)

Utilizator rares404AlShaytan - Balasescu Rares rares404 Data 27 martie 2020 19:36:30
Problema Permutari 3 Status done
Runda Arhiva de probleme Compilator cpp-64 | Vezi sursa
Scor 0

Raport evaluator

Eroare de compilare: main.cpp: In constructor 'BigInt::BigInt(std::__cxx11::string)': main.cpp:46:24: error: 'reverse' was not declared in this scope } R (N.begin(),N.end()); ^ main.cpp:20:13: warning: this 'while' clause does not guard... [-Wmisleading-indentation] #define WH while ^ main.cpp:47:2: note: in expansion of macro 'WH' WH (N.size()>1&&N[N.size()-1]=='0') N.erase (N.size()-1,N.size());if (N=="") ^~ main.cpp:47:68: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'while' WH (N.size()>1&&N[N.size()-1]=='0') N.erase (N.size()-1,N.size());if (N=="") ^~ main.cpp: In function 'bool operator<(BigInt, BigInt)': main.cpp:60:30: error: 'reverse' was not declared in this scope R (temp1.begin(),temp1.end());St temp2=SE.N; ^ main.cpp: In function 'bool operator>(BigInt, BigInt)': main.cpp:72:30: error: 'reverse' was not declared in this scope R (temp1.begin(),temp1.end());St temp2=SE.N; ^ main.cpp: In function 'std::istream& operator>>(std::istream&, BigInt&)': main.cpp:90:24: error: 'reverse' was not declared in this scope } R (N.begin(),N.end()); ^ main.cpp:20:13: warning: this 'while' clause does not guard... [-Wmisleading-indentation] #define WH while ^ main.cpp:91:2: note: in expansion of macro 'WH' WH (N.size()>1&&N[N.size()-1]=='0') N.erase (N.size()-1,N.size());bigint.N=N; ^~ main.cpp:91:68: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'while' WH (N.size()>1&&N[N.size()-1]=='0') N.erase (N.size()-1,N.size());bigint.N=N; ^~~~~~ main.cpp: In function 'std::ostream& operator<<(std::ostream&, const BigInt&)': main.cpp:96:22: error: 'reverse' was not declared in this scope R (N.begin(),N.end()); ^ main.cpp: In function 'BigInt operator+(BigInt, BigInt)': main.cpp:121:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if (i<n) add+= FI.N[i]-'0';if (i<m) add+= SE.N[i]-'0';carry=add / 10;result+= add % 10+'0';} if (carry != 0)result+= carry+'0';R (result.begin(),result.end());BigInt RS (result);RS.Ng=Ng;RT RS;}F BigInt OP+(BigInt bigint) {RT bigint;}F BigInt OP-(BigInt FI,BigInt SE) {if (SE.Ng) {SE.Ng=0;RT FI+SE;} if (FI.Ng) {SE.Ng=1;RT FI+SE;}bool Ng=0;if (FI<abs (SE)) {Ng=1;swap (FI,SE);FI=abs (FI);}int n=FI.N.size();int m=SE.N.size();int carry=0;St result;for (int i=0;i<max (n,m);i++) {int add=carry;if (i<n) add+= FI.N[i]-'0';if (i<m) add -= SE.N[i]-'0';if (add<0) {carry=-1;result+= add+10+'0';}else {carry=0;result+= add+'0';}}R (result.begin(),result.end());BigInt RS (result);RS.Ng=Ng;RT RS;}F BigInt OP-(BigInt SE) {BigInt FI ("0");RT FI-SE;}F BigInt OP*(BigInt FI,BigInt SE) {bool Ng=FI.Ng != SE.Ng;FI.Ng=0;SE.Ng=0;int n=FI.N.size();int m=SE.N.size();BigInt RS;for (int i=0;i<n;i++) {int carry=0;St result;for (int j=0;j<i;j++)result+= '0';for (int j=0;j<m;j++) {int add=carry+(FI.N[i]-'0')*(SE.N[j]-'0');carry=add / 10;result+= add % 10+'0';}if (carry != 0)result+= carry+'0';R (result.begin(),result.end());BigInt current (result);RS+= current;}RS.Ng=Ng;RT RS;}F BigInt OP / (BigInt FI,BigInt SE) {if (SE=="0")throw "Division with 0";bool Ng=FI.Ng != SE.Ng;FI.Ng=0;SE.Ng=0;BigInt Q;int i=FI.size()-1;BigInt current (FI.N[i]-'0');--i;WH (1) {BigInt result=current;bool l=0;WH (result<SE&&i >= 0) { result=result*10+(FI.N[i--]-'0');if (l)Q*= 10;l=1;}int c=0;BigInt RS (result);WH (RS >= SE) {RS -= SE;c++;} Q=Q*10+c;current=RS;if (i<0)break;}Q.Ng=Ng;RT Q;}F BigInt OP % (BigInt FI,BigInt SE) {if (SE=="0") throw "Modulo with 0";FI.Ng=0;SE.Ng=0;int i=FI.size()-1;BigInt current (FI.N[i]-'0');--i;WH (1) {BigInt result=current;WH (result<SE&&i >= 0)result=result*10+(FI.N[i--]-'0');int c=0;BigInt RS (result);WH (RS >= SE) {RS -= SE;c++;}current=RS;if (i<0)break;}current.Ng=SE.Ng;RT current;}F BigInt pow (BigInt x,BigInt y,BigInt mod=0) { if (mod != 0)x %= mod;BigInt res=1;WH (y != 0) {if (y % 2==1) {res*= x;if (mod != 0)res %= mod;} x*= x;if (mod != 0)x %= mod;y /= 2;} RT res;} F BigInt OP&(BigInt FI_,BigInt SE_) { St FI=FI_.int_to_base (2);St SE=SE_.int_to_base (2);unsigned int n=min (FI.size(),SE.size());R (FI.begin(),FI.end());R (SE.begin(),SE.end());St result (n,'~');for (unsigned int i=0;i<n;i++) { if (FI[i]=='1'&&SE[i]=='1') result[i]='1';else result[i]='0';} R (result.begin(),result.end());RT BigInt().base_to_int (result,2);} F BigInt OP | (BigInt FI_,BigInt SE_) { St FI=FI_.int_to_base (2);St SE=SE_.int_to_base (2);unsigned int n=max (FI.size(),SE.size());R (FI.begin(),FI.end());R (SE.begin(),SE.end());St result (n,'~');for (unsigned int i=0;i<n;i++) { if (FI.size() <= i || SE.size() <= i) { if (FI.size()>i) result[i]=FI[i];if (SE.size()>i) result[i]=SE[i];continue;} if (FI[i]=='1' || SE[i]=='1') result[i]='1';else result[i]='0';} R (result.begin(),result.end());RT BigInt().base_to_int (result,2);} F BigInt OP ^ (BigInt FI_,BigInt SE_) { St FI=FI_.int_to_base (2);St SE=SE_.int_to_base (2);unsigned int n=max (FI.size(),SE.size());R (FI.begin(),FI.end());R (SE.begin(),SE.end());St result (n,'~');for (unsigned int i=0;i<n;i++) { if (FI.size() <= i || SE.size() <= i) { if (FI.size()>i) {if (FI[i]=='0')result[i]='0';else result[i]='1';} if (SE.size()>i) {if (SE[i]=='0')result[i]='0';else result[i]='1';} continue;} if (FI[i]==SE[i])result[i]='0';else result[i]='1';} R (result.begin(),result.end());RT BigInt().base_to_int (result,2);} F BigInt OP << (BigInt FI,BigInt SE) { BigInt x=pow (2,SE);RT FI*x;} F BigInt OP >> (BigInt FI,BigInt SE) { BigInt x=pow (2,SE);RT FI / x;} int to_int (BigInt bigint) { int n=0;for (int i=bigint.N.size()-1;i >= 0;i--) n=(n*10)+(bigint.N[i]-'0');RT n;}St int_to_base (int base) {St result;BigInt bigint (*T);WH (bigint>0) {BigInt r=bigint % base;if (r >= 10)result+= (char) (to_int (r / 10)+'A');else result+= (char) (to_int (r)+'0');bigint /= base;}R (result.begin(),result.end());RT result;}BigInt base_to_int (St str,int base) {BigInt result;for (unsigned int i=0;i<str.size();i++) {BigInt add;if ('0' <= str[i]&&str[i] <= '9') add+= str[i]-'0';else add+= (str[i]-'A')+10;result=result*base+add;}RT result;}int size() {RT T->N.size();}void OP++() {*(T) =*(T)+1;}void OP -- () {*(T) =*(T)-1;}void OP+= (BigInt bigint) {*(T) =*(T)+bigint;}void OP -= (BigInt bigint) {*(T) =*(T)-bigint;}void OP*= (BigInt bigint) {*(T) =*(T)*bigint;}void OP /= (BigInt bigint) {*(T) =*(T) / bigint;}void OP %= (BigInt bigint) {*(T) =*(T) % bigint;}void OP&= (BigInt bigint) {*(T) =*(T)&bigint;}void OP |= (BigInt bigint) {*(T) =*(T) | bigint;}void OP ^= (BigInt bigint) {*(T) =*(T) ^ bigint;}void OP <<= (BigInt bigint) {*(T) =*(T) << bigint;}void OP >>= (BigInt bigint) {*(T) =*(T) >> bigint;}};using i64=long long; ^~ main.cpp:121:29: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' if (i<n) add+= FI.N[i]-'0';if (i<m) add+= SE.N[i]-'0';carry=add / 10;result+= add % 10+'0';} if (carry != 0)result+= carry+'0';R (result.begin(),result.end());BigInt RS (result);RS.Ng=Ng;RT RS;}F BigInt OP+(BigInt bigint) {RT bigint;}F BigInt OP-(BigInt FI,BigInt SE) {if (SE.Ng) {SE.Ng=0;RT FI+SE;} if (FI.Ng) {SE.Ng=1;RT FI+SE;}bool Ng=0;if (FI<abs (SE)) {Ng=1;swap (FI,SE);FI=abs (FI);}int n=FI.N.size();int m=SE.N.size();int carry=0;St result;for (int i=0;i<max (n,m);i++) {int add=carry;if (i<n) add+= FI.N[i]-'0';if (i<m) add -= SE.N[i]-'0';if (add<0) {carry=-1;result+= add+10+'0';}else {carry=0;result+= add+'0';}}R (result.begin(),result.end());BigInt RS (result);RS.Ng=Ng;RT RS;}F BigInt OP-(BigInt SE) {BigInt FI ("0");RT FI-SE;}F BigInt OP*(BigInt FI,BigInt SE) {bool Ng=FI.Ng != SE.Ng;FI.Ng=0;SE.Ng=0;int n=FI.N.size();int m=SE.N.size();BigInt RS;for (int i=0;i<n;i++) {int carry=0;St result;for (int j=0;j<i;j++)result+= '0';for (int j=0;j<m;j++) {int add=carry+(FI.N[i]-'0')*(SE.N[j]-'0');carry=add / 10;result+= add % 10+'0';}if (carry != 0)result+= carry+'0';R (result.begin(),result.end());BigInt current (result);RS+= current;}RS.Ng=Ng;RT RS;}F BigInt OP / (BigInt FI,BigInt SE) {if (SE=="0")throw "Division with 0";bool Ng=FI.Ng != SE.Ng;FI.Ng=0;SE.Ng=0;BigInt Q;int i=FI.size()-1;BigInt current (FI.N[i]-'0');--i;WH (1) {BigInt result=current;bool l=0;WH (result<SE&&i >= 0) { result=result*10+(FI.N[i--]-'0');if (l)Q*= 10;l=1;}int c=0;BigInt RS (result);WH (RS >= SE) {RS -= SE;c++;} Q=Q*10+c;current=RS;if (i<0)break;}Q.Ng=Ng;RT Q;}F BigInt OP % (BigInt FI,BigInt SE) {if (SE=="0") throw "Modulo with 0";FI.Ng=0;SE.Ng=0;int i=FI.size()-1;BigInt current (FI.N[i]-'0');--i;WH (1) {BigInt result=current;WH (result<SE&&i >= 0)result=result*10+(FI.N[i--]-'0');int c=0;BigInt RS (result);WH (RS >= SE) {RS -= SE;c++;}current=RS;if (i<0)break;}current.Ng=SE.Ng;RT current;}F BigInt pow (BigInt x,BigInt y,BigInt mod=0) { if (mod != 0)x %= mod;BigInt res=1;WH (y != 0) {if (y % 2==1) {res*= x;if (mod != 0)res %= mod;} x*= x;if (mod != 0)x %= mod;y /= 2;} RT res;} F BigInt OP&(BigInt FI_,BigInt SE_) { St FI=FI_.int_to_base (2);St SE=SE_.int_to_base (2);unsigned int n=min (FI.size(),SE.size());R (FI.begin(),FI.end());R (SE.begin(),SE.end());St result (n,'~');for (unsigned int i=0;i<n;i++) { if (FI[i]=='1'&&SE[i]=='1') result[i]='1';else result[i]='0';} R (result.begin(),result.end());RT BigInt().base_to_int (result,2);} F BigInt OP | (BigInt FI_,BigInt SE_) { St FI=FI_.int_to_base (2);St SE=SE_.int_to_base (2);unsigned int n=max (FI.size(),SE.size());R (FI.begin(),FI.end());R (SE.begin(),SE.end());St result (n,'~');for (unsigned int i=0;i<n;i++) { if (FI.size() <= i || SE.size() <= i) { if (FI.size()>i) result[i]=FI[i];if (SE.size()>i) result[i]=SE[i];continue;} if (FI[i]=='1' || SE[i]=='1') result[i]='1';else result[i]='0';} R (result.begin(),result.end());RT BigInt().base_to_int (result,2);} F BigInt OP ^ (BigInt FI_,BigInt SE_) { St FI=FI_.int_to_base (2);St SE=SE_.int_to_base (2);unsigned int n=max (FI.size(),SE.size());R (FI.begin(),FI.end());R (SE.begin(),SE.end());St result (n,'~');for (unsigned int i=0;i<n;i++) { if (FI.size() <= i || SE.size() <= i) { if (FI.size()>i) {if (FI[i]=='0')result[i]='0';else result[i]='1';} if (SE.size()>i) {if (SE[i]=='0')result[i]='0';else result[i]='1';} continue;} if (FI[i]==SE[i])result[i]='0';else result[i]='1';} R (result.begin(),result.end());RT BigInt().base_to_int (result,2);} F BigInt OP << (BigInt FI,BigInt SE) { BigInt x=pow (2,SE);RT FI*x;} F BigInt OP >> (BigInt FI,BigInt SE) { BigInt x=pow (2,SE);RT FI / x;} int to_int (BigInt bigint) { int n=0;for (int i=bigint.N.size()-1;i >= 0;i--) n=(n*10)+(bigint.N[i]-'0');RT n;}St int_to_base (int base) {St result;BigInt bigint (*T);WH (bigint>0) {BigInt r=bigint % base;if (r >= 10)result+= (char) (to_int (r / 10)+'A');else result+= (char) (to_int (r)+'0');bigint /= base;}R (result.begin(),result.end());RT result;}BigInt base_to_int (St str,int base) {BigInt result;for (unsigned int i=0;i<str.size();i++) {BigInt add;if ('0' <= str[i]&&str[i] <= '9') add+= str[i]-'0';else add+= (str[i]-'A')+10;result=result*base+add;}RT result;}int size() {RT T->N.size();}void OP++() {*(T) =*(T)+1;}void OP -- () {*(T) =*(T)-1;}void OP+= (BigInt bigint) {*(T) =*(T)+bigint;}void OP -= (BigInt bigint) {*(T) =*(T)-bigint;}void OP*= (BigInt bigint) {*(T) =*(T)*bigint;}void OP /= (BigInt bigint) {*(T) =*(T) / bigint;}void OP %= (BigInt bigint) {*(T) =*(T) % bigint;}void OP&= (BigInt bigint) {*(T) =*(T)&bigint;}void OP |= (BigInt bigint) {*(T) =*(T) | bigint;}void OP ^= (BigInt bigint) {*(T) =*(T) ^ bigint;}void OP <<= (BigInt bigint) {*(T) =*(T) << bigint;}void OP >>= (BigInt bigint) {*(T) =*(T) >> bigint;}};using i64=long long; ^~ main.cpp:121:159: error: 'reverse' was not declared in this scope if (i<n) add+= FI.N[i]-'0';if (i<m) add+= SE.N[i]-'0';carry=add / 10;result+= add % 10+'0';} if (carry != 0)result+= carry+'0';R (result.begin(),result.end());BigInt RS (result);RS.Ng=Ng;RT RS;}F BigInt OP+(BigInt bigint) {RT bigint;}F BigInt OP-(BigInt FI,BigInt SE) {if (SE.Ng) {SE.Ng=0;RT FI+SE;} if (FI.Ng) {SE.Ng=1;RT FI+SE;}bool Ng=0;if (FI<abs (SE)) {Ng=1;swap (FI,SE);FI=abs (FI);}int n=FI.N.size();int m=SE.N.size();int carry=0;St result;for (int i=0;i<max (n,m);i++) {int add=carry;if (i<n) add+= FI.N[i]-'0';if (i<m) add -= SE.N[i]-'0';if (add<0) {carry=-1;result+= add+10+'0';}else {carry=0;result+= add+'0';}}R (result.begin(),result.end());BigInt RS (result);RS.Ng=Ng;RT RS;}F BigInt OP-(BigInt SE) {BigInt FI ("0");RT FI-SE;}F BigInt OP*(BigInt FI,BigInt SE) {bool Ng=FI.Ng != SE.Ng;FI.Ng=0;SE.Ng=0;int n=FI.N.size();int m=SE.N.size();BigInt RS;for (int i=0;i<n;i++) {int carry=0;St result;for (int j=0;j<i;j++)result+= '0';for (int j=0;j<m;j++) {int add=carry+(FI.N[i]-'0')*(SE.N[j]-'0');carry=add / 10;result+= add % 10+'0';}if (carry != 0)result+= carry+'0';R (result.begin(),result.end());BigInt current (result);RS+= current;}RS.Ng=Ng;RT RS;}F BigInt OP / (BigInt FI,BigInt SE) {if (SE=="0")throw "Division with 0";bool Ng=FI.Ng != SE.Ng;FI.Ng=0;SE.Ng=0;BigInt Q;int i=FI.size()-1;BigInt current (FI.N[i]-'0');--i;WH (1) {BigInt result=current;bool l=0;WH (result<SE&&i >= 0) { result=result*10+(FI.N[i--]-'0');if (l)Q*= 10;l=1;}int c=0;BigInt RS (result);WH (RS >= SE) {RS -= SE;c++;} Q=Q*10+c;current=RS;if (i<0)break;}Q.Ng=Ng;RT Q;}F BigInt OP % (BigInt FI,BigInt SE) {if (SE=="0") throw "Modulo with 0";FI.Ng=0;SE.Ng=0;int i=FI.size()-1;BigInt current (FI.N[i]-'0');--i;WH (1) {BigInt result=current;WH (result<SE&&i >= 0)result=result*10+(FI.N[i--]-'0');int c=0;BigInt RS (result);WH (RS >= SE) {RS -= SE;c++;}current=RS;if (i<0)break;}current.Ng=SE.Ng;RT current;}F BigInt pow (BigInt x,BigInt y,BigInt mod=0) { if (mod != 0)x %= mod;BigInt res=1;WH (y != 0) {if (y % 2==1) {res*= x;if (mod != 0)res %= mod;} x*= x;if (mod != 0)x %= mod;y /= 2;} RT res;} F BigInt OP&(BigInt FI_,BigInt SE_) { St FI=FI_.int_to_base (2);St SE=SE_.int_to_base (2);unsigned int n=min (FI.size(),SE.size());R (FI.begin(),FI.end());R (SE.begin(),SE.end());St result (n,'~');for (unsigned int i=0;i<n;i++) { if (FI[i]=='1'&&SE[i]=='1') result[i]='1';else result[i]='0';} R (result.begin(),result.end());RT BigInt().base_to_int (result,2);} F BigInt OP | (BigInt FI_,BigInt SE_) { St FI=FI_.int_to_base (2);St SE=SE_.int_to_base (2);unsigned int n=max (FI.size(),SE.size());R (FI.begin(),FI.end());R (SE.begin(),SE.end());St result (n,'~');for (unsigned int i=0;i<n;i++) { if (FI.size() <= i || SE.size() <= i) { if (FI.size()>i) result[i]=FI[i];if (SE.size()>i) result[i]=SE[i];continue;} if (FI[i]=='1' || SE[i]=='1') result[i]='1';else result[i]='0';} R (result.begin(),result.end());RT BigInt().base_to_int (result,2);} F BigInt OP ^ (BigInt FI_,BigInt SE_) { St FI=FI_.int_to_base (2);St SE=SE_.int_to_base (2);unsigned int n=max (FI.size(),SE.size());R (FI.begin(),FI.end());R (SE.begin(),SE.end());St result (n,'~');for (unsigned int i=0;i<n;i++) { if (FI.size() <= i || SE.size() <= i) { if (FI.size()>i) {if (FI[i]=='0')result[i]='0';else result[i]='1';} if (SE.size()>i) {if (SE[i]=='0')result[i]='0';else result[i]='1';} continue;} if (FI[i]==SE[i])result[i]='0';else result[i]='1';} R (result.begin(),result.end());RT BigInt().base_to_int (result,2);} F BigInt OP << (BigInt FI,BigInt SE) { BigInt x=pow (2,SE);RT FI*x;} F BigInt OP >> (BigInt FI,BigInt SE) { BigInt x=pow (2,SE);RT FI / x;} int to_int (BigInt bigint) { int n=0;for (int i=bigint.N.size()-1;i >= 0;i--) n=(n*10)+(bigint.N[i]-'0');RT n;}St int_to_base (int base) {St result;BigInt bigint (*T);WH (bigint>0) {BigInt r=bigint % base;if (r >= 10)result+= (char) (to_int (r / 10)+'A');else result+= (char) (to_int (r)+'0');bigint /= base;}R (result.begin(),result.end());RT result;}BigInt base_to_int (St str,int base) {BigInt result;for (unsigned int i=0;i<str.size();i++) {BigInt add;if ('0' <= str[i]&&str[i] <= '9') add+= str[i]-'0';else add+= (str[i]-'A')+10;result=result*base+add;}RT result;}int size() {RT T->N.size();}void OP++() {*(T) =*(T)+1;}void OP -- () {*(T) =*(T)-1;}void OP+= (BigInt bigint) {*(T) =*(T)+bigint;}void OP -= (BigInt bigint) {*(T) =*(T)-bigint;}void OP*= (BigInt bigint) {*(T) =*(T)*bigint;}void OP /= (BigInt bigint) {*(T) =*(T) / bigint;}void OP %= (BigInt bigint) {*(T) =*(T) % bigint;}void OP&= (BigInt bigint) {*(T) =*(T)&bigint;}void OP |= (BigInt bigint) {*(T) =*(T) | bigint;}void OP ^= (BigInt bigint) {*(T) =*(T) ^ bigint;}void OP <<= (BigInt bigint) {*(T) =*(T) << bigint;}void OP >>= (BigInt bigint) {*(T) =*(T) >> bigint;}};using i64=long long; ^ main.cpp: In function 'BigInt operator-(BigInt, BigInt)': main.cpp:121:654: error: 'reverse' was not declared in this scope Non zero exit status: 1

Ceva nu functioneaza?