how to add our code template in codeforces editor ? Also, can there be run option in codeforces
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 151 |
how to add our code template in codeforces editor ? Also, can there be run option in codeforces
using namespace std; long long int setBitNumber(long long int n) { if (n == 0) return 0;
long long int msb = 0; n = n / 2; while (n != 0) { n = n / 2; msb++; } return (1 << msb);
} int main() { long int t; cin>>t; while(t--){ long long int n,i,cnt=0; cin>>n; long long int a[n],b[n],maxi=0,gcnt=0; for(i=0;i<n;i++) { cin>>a[i]; maxi=max(a[i],maxi); } long int p =setBitNumber(maxi); long int q=log(p)/log(2); if(p==1) {
} for(int j=0;j<=(q);j++) { for(i=0;i<n;i++) { if(a[i]>=p) { b[i]=1; } else { b[i]=0; } if(b[i]==1) { cnt++; a[i]=0; } } gcnt =gcnt + cnt*(cnt-1)/2; cnt=0; p=p/2; } cout<<gcnt<<endl; }
} what is wrong in the code ?
Name |
---|