Submission #933060

# Submission time Handle Problem Language Result Execution time Memory
933060 2024-02-25T00:27:02 Z vjudge1 Selling RNA Strands (JOI16_selling_rna) C++17
0 / 100
2 ms 604 KB
#include<bits/stdc++.h>
using namespace std;

using ll = long long;
using pl = pair<ll,ll>;
using vl = vector<ll>;
 
#define all(a) a.begin(),a.end()
#define sor(a) sort(all(a));
#define sz size()
#define pb push_back
#define f first
#define s second
#define ft front()
#define nl "\n"
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define F0R(i,a) FOR(i,0,a)
#define rep(a) F0R(_,a)
#define each(i,a) for(auto i:a)

void solve(){
	ll n,m;
	cin>>n>>m;
	vl t(n);
	string st;
	bitset<200000>s[n],sr[n],tp,tpr,k;
	F0R(i,n){
		cin>>st;
		t[i]=st.sz;
		F0R(j,t[i]){
			if(st[j]=='A')s[i][j*2]=0,s[i][j*2+1]=0;
			if(st[j]=='G')s[i][j*2]=0,s[i][j*2+1]=1;
			if(st[j]=='C')s[i][j*2]=1,s[i][j*2+1]=0;
			if(st[j]=='U')s[i][j*2]=1,s[i][j*2+1]=1;
			if(st[t[i]-1-j]=='A')sr[i][j*2]=0,sr[i][j*2+1]=0;
			if(st[t[i]-1-j]=='G')sr[i][j*2]=0,sr[i][j*2+1]=1;
			if(st[t[i]-1-j]=='C')sr[i][j*2]=1,sr[i][j*2+1]=0;
			if(st[t[i]-1-j]=='U')sr[i][j*2]=1,sr[i][j*2+1]=1;
		}
	}
	rep(m){
		string p,q;
		cin>>p>>q;
		ll ps=p.sz,qs=q.sz;
		bitset<200000>bt,btr;
		F0R(i,ps*2)bt[i]=1;
		F0R(i,qs*2)btr[i]=1;
		F0R(j,ps){
			if(p[j]=='A')tp[j*2]=0,tp[j*2+1]=0;
			if(p[j]=='G')tp[j*2]=0,tp[j*2+1]=1;
			if(p[j]=='C')tp[j*2]=1,tp[j*2+1]=0;
			if(p[j]=='U')tp[j*2]=1,tp[j*2+1]=1;
		}
		F0R(j,qs){
			if(q[qs-1-j]=='A')tpr[j*2]=0,tpr[j*2+1]=0;
			if(q[qs-1-j]=='G')tpr[j*2]=0,tpr[j*2+1]=1;
			if(q[qs-1-j]=='C')tpr[j*2]=1,tpr[j*2+1]=0;
			if(q[qs-1-j]=='U')tpr[j*2]=1,tpr[j*2+1]=1;
		}
		tp&=bt;
		tpr&=btr;

		ll r=0;
		F0R(i,n){
			if(max(ps,qs)<=t[i]&&tp==(s[i]&bt)&&tpr==(sr[i]&btr))r++;
		}
		cout<<r<<nl;
	}
}

int main(){
	cin.tie(0)->sync_with_stdio(0);
	freopen("test.in","r",stdin),freopen("test.out","w",stdout);
	solve();
	return 1<<32;
}

Compilation message

selling_rna.cpp: In function 'int main()':
selling_rna.cpp:76:10: warning: left shift count >= width of type [-Wshift-count-overflow]
   76 |  return 1<<32;
      |         ~^~~~
selling_rna.cpp:74:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 |  freopen("test.in","r",stdin),freopen("test.out","w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
selling_rna.cpp:74:38: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 |  freopen("test.in","r",stdin),freopen("test.out","w",stdout);
      |                               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -