답안 #933057

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
933057 2024-02-25T00:13:03 Z vjudge1 Selling RNA Strands (JOI16_selling_rna) C++17
0 / 100
1500 ms 1048576 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],temp,tempr,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')temp[j*2]=0,temp[j*2+1]=0;
			if(p[j]=='G')temp[j*2]=0,temp[j*2+1]=1;
			if(p[j]=='C')temp[j*2]=1,temp[j*2+1]=0;
			if(p[j]=='U')temp[j*2]=1,temp[j*2+1]=1;
		}
		F0R(j,qs){
			if(q[qs-1-j]=='A')tempr[j*2]=0,tempr[j*2+1]=0;
			if(q[qs-1-j]=='G')tempr[j*2]=0,tempr[j*2+1]=1;
			if(q[qs-1-j]=='C')tempr[j*2]=1,tempr[j*2+1]=0;
			if(q[qs-1-j]=='U')tempr[j*2]=1,tempr[j*2+1]=1;
		}
		temp&=bt;
		tempr&=btr;

		ll r=0;
		F0R(i,n){
			if(temp==(s[i]&bt)&&tempr==(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;
      |         ~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 5468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1527 ms 98452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 582 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 5468 KB Output isn't correct
2 Halted 0 ms 0 KB -