c++ - gcc throwing error relocation truncated to fit: R_X86_64_32 against `.bss' -
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 int dp[100000][100000]; int main() {     long int n;     cin>>n;     vector <int> a(n);     for(long int i=0;i<n;i++)         cin>>a[i];     memset(dp,0,sizeof(dp));     long long int maxi=0;     for(long int i=0;i<n;i++)     {         for(long int j=i;j<n;j++)         {             dp[i][j]=dp[i][j-1]^a[j];              dp[i][j]%=mod;              if(maxi<dp[i][j])                  maxi=dp[i][j];         }     }     cout<<maxi;     return 0; }          compiler throwing error  : in function _global__sub_i_dp': (.text.startup+0x185): relocation truncated fit: r_x86_64_32 against.bss' (.text.startup+0x194): relocation truncated fit: r_x86_64_32 against `.bss' error: ld returned 1 exit status error ?
your global array takes 40gb, can't put in program's .data section. doesn't fit there.
even if did, end gigantic binary, it's bad idea in first place.
if have 45+gb ram installed, can use dynamic allocation (via std::vector) this, otherwise, rethink code need less memory.
Comments
Post a Comment