Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //author: Ryuuk
- //Date: 2018-05-16 20:51:42
- #include<bits/stdc++.h>
- #define sz(a) int((a).size())
- #define pb push_back
- #define all(c) (c).begin(),(c).end()
- #define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
- #define present(c,x) ((c).find(x) != (c).end())
- #define cpresent(c,x) (find(all(c),x) != (c).end())
- #define LSOne(i) (i&(-i))
- #define rep(i,a,b) for(int(i)=(a);(i)<(b);i++)
- #define BUG(x) {cout<<#x<<" = "<<x<<endl;}
- #define left(x) (x<<1)
- #define right(x) ((x<<1) +1)
- #define middle(s,e)(s+(e-s)/2)
- #define size_tree(n) 2*(int)pow(2,ceil(log2(n)))
- #define CL(A,I) (memset(A,I,sizeof(A)))
- #define endl '\n'
- static const int INF = 0x3f3f3f3f;
- static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
- static const long double epsilon = 1e-15;
- static const long double pi = acos((long double) -1);
- using namespace std;
- inline void init_io(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
- typedef vector<int> vi;
- typedef vector<vi> vvi;
- typedef pair<int,int> ii;
- typedef long long ll;
- int main()
- {
- #ifndef ONLINE_JUDGE
- freopen("input.txt","r",stdin);
- //freopen("output.txt","w",stdout);
- #endif // ONLINE_JUDGE
- init_io();
- int n,q,b;
- string s,s2;
- cin>>n>>s>>q;
- for (int i=0; i<n/2; i++)
- swap(s[i], s[n-i-1]);
- s2 = s;
- int last = 0,offset = 0;
- rep(i,0,s.size())
- if(s[i]-'0'==1)
- last = i ;
- rep(i,0,q)
- {
- cin>>offset;
- for(int j=offset;j<=last;j++)
- s2[j-offset] = char(((s2[j-offset]-'0') | (s[j]-'0'))+'0');
- }
- for (int i=0; i<n/2; i++)
- swap(s2[i], s2[n-i-1]);
- cout<<s2<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement