# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
933036 | 2024-02-24T22:39:07 Z | vjudge1 | Selling RNA Strands (JOI16_selling_rna) | C++ | 1500 ms | 5680 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int n, m; string cad[100000]; bool checa(int pos, string &s1, string &s2){ if(cad[pos].size()<s1.size() || cad[pos].size()<s2.size()) return 0; int tam=cad[pos].size(); for(int i=0; i<s1.size(); i++){ if(s1[i]!=cad[pos][i]) return 0; } for(int i=0; i<s2.size(); i++){ if(s2[i]!=cad[pos][tam-i-1]) return 0; } return 1; } void busca(string &s1, string &s2){ int ans=0; for(int i=0; i<n; i++){ if(checa(i, s1, s2)) ans++; } cout<< ans<< "\n"; } void solve(){ cin>> n>> m; string s1, s2; for(int i=0; i<n; i++){ cin>> cad[i]; } for(int i=0; i<m; i++){ cin>> s1>> s2; busca(s1, s2); } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int t=1; //cin>> t; while(t--){ solve(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 3420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 427 ms | 5680 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1508 ms | 3416 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 3420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |