제출 #1067792

#제출 시각아이디문제언어결과실행 시간메모리
1067792tnkhuyenSelling RNA Strands (JOI16_selling_rna)C++14
10 / 100
1565 ms9552 KiB
#include<bits/stdc++.h> #define ll long long #define FOR(i,a,b) for(ll i=(ll)a; i<=(ll)b; i++) #define ROF(i,b,a) for(ll i=(ll)b; i>=(ll)a; i--) using namespace std; const ll maxn = 1e5 + 1; ll n, m; string a[maxn], x, y; void sub1(){ ll co = 0, id; bool kt1, kt2; FOR(i,1,m){ cin >> x >> y; // if (i == 1) continue; // cout << x << " " << y << endl; co = 0; FOR(j,1,n){ kt1 = true; kt2 = true; id = 0; FOR(k,0,x.size()-1){ if (a[j][id] != x[k]){ // cout << "hi" << " " << a[j][k] << " " << x[k] << endl; // cout << 1 << " " << j << " " << k << " " << a[id][k] << " " << x[k] << endl; kt1 = false; break; } id++; } id = a[j].size()-1; ROF(k,y.size()-1,0){ if (a[j][id] !=y[k]){ // cout << 2 << " " << j << " " << k << " " << a[j][id] << " " << y[k] << endl; kt2 = false; break; } id--; } // cout << i << " " << j << " " << kt1 << " " << kt2 << endl; if (kt1 == true && kt2 == true){ co++; } } cout << co << "\n"; } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; FOR(i,1,n){ cin >> a[i]; } // x = "aaaa"; // cout << "hi" << " " << x[x.size()] << endl; sub1(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...