# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
398516 | 2021-05-04T12:47:55 Z | model_code | Brperm (RMI20_brperm) | C++17 | 5000 ms | 1896 KB |
/** * user: andrei-a80 * fname: Alexandru * lname: Andrei * task: Brperm * score: 83.0 * date: 2020-12-03 12:50:14.346718 */ #include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 #include "brperm.h" #define ll long long #define double long double #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #define f first #define s second #define pb push_back #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000000007 #define PI 3.14159265359 #define MAXN 100005 #define INF 1000000005 #define LINF 1000000000000000005ll #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; int n; string a; void init(int n,const char s[]){ for(int i=0;i<n;i++) { a.pb(s[i]); } } int query(int i,int k){ int aba=(1<<k)-1; if(i+(1<<k)>a.size()){ return 0; } for(int j=i+(1<<k)-1;j>=i;j--) { int x=aba; string bit=""; //cout<<x<<' '; for(int nr=k-1;nr>=0;nr--) { if(x>=(1<<nr)){ bit+='1'; x-=(1<<nr); }else bit+='0'; } //cout<<bit<<' '; int indx=0; for(int nr=0;nr<bit.size();nr++) { if(bit[nr]=='1'){ indx+=(1<<nr); } } //cout<<indx<<' '<<j<<endl; if(a[i+indx]!=a[j]){ return 0; } aba--; } return 1; } /* int32_t main(){ CODE_START; string val="axxyxxyb"; init(8,val); cout<<query(0,3)<<endl; cout<<query(1,1)<<endl; cout<<query(3,2)<<endl; cout<<query(1,2)<<endl; } */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 59 ms | 816 KB | Output is correct |
4 | Correct | 48 ms | 712 KB | Output is correct |
5 | Correct | 44 ms | 728 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5038 ms | 1896 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 59 ms | 816 KB | Output is correct |
4 | Correct | 48 ms | 712 KB | Output is correct |
5 | Correct | 44 ms | 728 KB | Output is correct |
6 | Execution timed out | 5038 ms | 1896 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |