| Task: | Binääripuu |
| Sender: | Tuomas Katajisto |
| Submission time: | 2019-01-17 14:32:47 +0200 |
| Language: | C++ |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:58:2: error: jump to label 'res' [-fpermissive]
res:
^~~
input/code.cpp:22:41: note: from here
if(m == 0) { sv = n-2; so = n-2; goto res;}
^~~
input/code.cpp:33:8: note: crosses initialization of 'long int pro'
long pro = 0;
^~~
input/code.cpp:32:8: note: crosses initialization of 'bool inte'
bool inte = false;
^~~~
input/code.cpp:31:8: note: crosses initialization of 'long int it'
long it = 2;
^~
input/code.cpp:30:7: note: crosses initialization of 'int k'
int k = 1;
^
input/code.cpp:24:13: note: crosses initialization of 'std::set<long int> fb'
set<long> fb;
^~Code
#include<bits/stdc++.h>
using namespace std;
long long M = 1e9+7;
long long pw(long long x, long long n) {
if(n == 1) return x;
if(n == 0) return 1;
if(n%2==0) {
long long bb = pw(x,n/2);
return (bb*bb)%M;
}
else {
return ((pw(x,n-1)*x)%M);
}
}
int main() {
int n,m;cin>>n>>m;
long long sv; long long so;
sv = 0; so = 0;
if(m == 0) { sv = n-2; so = n-2; goto res;}
bool kr[1010101];
set<long> fb;
kr[1] = true;
for(int i = 0; i < m; i++) {
long a; cin >> a;
fb.insert(a);
}
int k = 1;
long it = 2;
bool inte = false;
long pro = 0;
while(k < n) {
if(k == n-1 && !inte) pro = it;
long kk = pw(2,k);
for(int i = 0; i < kk; i++) {
if(fb.count(it)) kr[i] = false;
else {
kr[it] = kr[it/2];
}
it++;
}
k++;
}
//cout << "\n";
for(int i = pro; i < pro+pro/2; i++) {
if(kr[i]) sv++;
//cout << kr[i] << " ";
}
for(int i = pro+pro/2; i < 2*pro; i++) {
if(kr[i]) so++;
//cout << kr[i] << " ";
}
//cout << endl;
//cout << sv << " :: " << so << "\n";
res:
cout << (((sv*so)%M)*2)%M;
}
