Submission #743307

# Submission time Handle Problem Language Result Execution time Memory
743307 2023-05-17T09:44:19 Z zaneyu Modern Machine (JOI23_ho_t5) C++17
3 / 100
3000 ms 1256 KB
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using pii=pair<int,int>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()),c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll maxn=6e6+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const int MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-4;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
int arr[maxn];
int main(){
	int n,m;
	cin>>n>>m;
	string s;
	cin>>s;
	REP(i,m){
		cin>>arr[i];
		--arr[i];
	}
	int q;
	cin>>q;
	while(q--){
		int l,r;
		cin>>l>>r;
		--l,--r;
		string tmp=s;
		for(int i=l;i<=r;i++){
			int p=arr[i];
			s[p]='R';
			while(p!=n and p>=0){
				if(s[p]=='R') s[p++]='B';
				else s[p--]='R';
			}
		}
		int ans=0;
		REP(i,n) ans+=(s[i]=='R');
		cout<<ans<<'\n';
		s=tmp;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 312 KB Output is correct
7 Correct 5 ms 212 KB Output is correct
8 Correct 14 ms 312 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 312 KB Output is correct
7 Correct 5 ms 212 KB Output is correct
8 Correct 14 ms 312 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 93 ms 368 KB Output is correct
11 Correct 661 ms 364 KB Output is correct
12 Execution timed out 3039 ms 340 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 312 KB Output is correct
7 Correct 5 ms 212 KB Output is correct
8 Correct 14 ms 312 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 93 ms 368 KB Output is correct
11 Correct 661 ms 364 KB Output is correct
12 Execution timed out 3039 ms 340 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 3025 ms 1256 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 3025 ms 1256 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 3025 ms 1256 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 312 KB Output is correct
7 Correct 5 ms 212 KB Output is correct
8 Correct 14 ms 312 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 93 ms 368 KB Output is correct
11 Correct 661 ms 364 KB Output is correct
12 Execution timed out 3039 ms 340 KB Time limit exceeded
13 Halted 0 ms 0 KB -