# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
645764 |
2022-09-28T00:11:53 Z |
rodov |
Brperm (RMI20_brperm) |
C++14 |
|
3000 ms |
2744 KB |
using namespace std;
#include <bits/stdc++.h>
#define ll int
//string s;
ll mas[500007];
ll N;
void init(int n, const char s[]) {
N=n;
for(int i=0;i<N;i++){
mas[i]=s[i]-'a'+1;
//cout<<mas[i]<<' ';
}
return;
}
string bin;
ll a1,a2;
ll f(ll v,ll k){
bin="";
for(int i=1;i<=k;i++){
if(v%2==0){
bin+='0';
}else{
bin+='1';
}
v/=2;
}
//reverse(bin.begin(),bin.end());
a1=1;a2=0;
for(int i=k;i>=1;i--){
if(bin[i-1]=='0'){
a1*=2;
}else{
a2+=a1;
a1+=a1;
}
}
return a2;
}
int query(int i, int k) {
if(i+(pow(2,k))>N)return 0;
for(int j=i;j<=i+pow(2,k)-1;j++){
//cout<<f(j-i,k)<<' '<<j<<endl;
if(mas[i+f(j-i,k)]!=mas[j])return 0;
}
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
50 ms |
944 KB |
Output is correct |
4 |
Correct |
47 ms |
920 KB |
Output is correct |
5 |
Correct |
43 ms |
936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3084 ms |
2744 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
50 ms |
944 KB |
Output is correct |
4 |
Correct |
47 ms |
920 KB |
Output is correct |
5 |
Correct |
43 ms |
936 KB |
Output is correct |
6 |
Execution timed out |
3084 ms |
2744 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |