답안 #237917

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
237917 2020-06-09T09:50:24 Z tc_abd Selling RNA Strands (JOI16_selling_rna) C++14
10 / 100
829 ms 1048580 KB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define It it=se.begin();it!=se.end();it++
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(x) begin(x),end(x)
#define unmap unordered_map
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define pb push_back
#define sh short int
#define mid (l+r)/2
#define S second
#define F first
#define sqr 447
using namespace std;
const int inf = 1e9+9;
const int mod = 1e9+7;
const ld pai=acos(-1);
int n,m;
unordered_map < string , bool > pre[5009];
unordered_map < string , bool > suf[5009];
int main(){
    fast,cin>>n>>m;
    for(int i=0;i<n;i++){
        string s; cin>>s;
        int sz = s.size();
        string s1 = "";
        for(int j=0;j<sz;j++){
            s1 += s[j];
            pre[i][s1] = 1;
        }
        string s2 = "";
        for(int j=sz-1;j>=0;j--){
            s2 += s[j];
            suf[i][s2] = 1;
        }
    }
    for(int i=0;i<m;i++){
        int ans = 0;
        string s1,s2;
        cin>>s1>>s2;
        reverse(all(s2));
        for(int j=0;j<n;j++){
            ans += (pre[j][s1] && suf[j][s2]);
        }
        cout<<ans<<endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1280 KB Output is correct
2 Correct 8 ms 1280 KB Output is correct
3 Correct 6 ms 1280 KB Output is correct
4 Correct 7 ms 1280 KB Output is correct
5 Correct 6 ms 1280 KB Output is correct
6 Correct 6 ms 1152 KB Output is correct
7 Correct 6 ms 1280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 829 ms 1048580 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 4864 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1280 KB Output is correct
2 Correct 8 ms 1280 KB Output is correct
3 Correct 6 ms 1280 KB Output is correct
4 Correct 7 ms 1280 KB Output is correct
5 Correct 6 ms 1280 KB Output is correct
6 Correct 6 ms 1152 KB Output is correct
7 Correct 6 ms 1280 KB Output is correct
8 Runtime error 829 ms 1048580 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -