Submission #1096558

# Submission time Handle Problem Language Result Execution time Memory
1096558 2024-10-04T18:17:51 Z Abito Modern Machine (JOI23_ho_t5) C++17
15 / 100
77 ms 604 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
typedef unsigned long long ull;
using namespace std;
const int N=7005;
int n,m,q,a[N],p[N];
bool b[N];
int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n>>m;
	for (int i=1;i<=n;i++){
		char c;cin>>c;
		if (c=='R') b[i]=1;
	}
	for (int i=1;i<=m;i++) cin>>a[i];
	cin>>q;
	int s,e;
	cin>>s>>e;
	for (int i=s;i<=e;i++){
		b[a[i]]=1;
		int L=a[i],R=a[i];
		bool h=1;
		while (L && R<=n){
			if (h){
				while (b[R+1]==1) R++;
				//cout<<L<<' '<<R<<endl;
				p[L]++;
				p[R+1]--;
				R++;
				h=!h;
			}
			else{
				while (b[L-1]==0 && L>1) L--;
				//cout<<L<<' '<<R<<endl;
				p[L]++;
				p[R+1]--;
				L--;
				h=!h;
			}
		}
		for (int j=1;j<=n;j++){
			p[j]+=p[j-1];
			if (p[j]%2) b[j]^=1;
		}
		for (int j=1;j<=n;j++) p[j]=0;
	}
	int ans=0;
	for (int i=1;i<=n;i++) ans+=b[i];
	cout<<ans<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 27 ms 348 KB Output is correct
11 Correct 13 ms 348 KB Output is correct
12 Correct 39 ms 604 KB Output is correct
13 Correct 77 ms 604 KB Output is correct
14 Correct 42 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 27 ms 348 KB Output is correct
11 Correct 13 ms 348 KB Output is correct
12 Correct 39 ms 604 KB Output is correct
13 Correct 77 ms 604 KB Output is correct
14 Correct 42 ms 348 KB Output is correct
15 Incorrect 1 ms 348 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 27 ms 348 KB Output is correct
11 Correct 13 ms 348 KB Output is correct
12 Correct 39 ms 604 KB Output is correct
13 Correct 77 ms 604 KB Output is correct
14 Correct 42 ms 348 KB Output is correct
15 Incorrect 1 ms 348 KB Output isn't correct
16 Halted 0 ms 0 KB -