답안 #933036

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
933036 2024-02-24T22:39:07 Z vjudge1 Selling RNA Strands (JOI16_selling_rna) C++
0 / 100
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

selling_rna.cpp: In function 'bool checa(int, std::string&, std::string&)':
selling_rna.cpp:13:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0; i<s1.size(); i++){
      |                  ~^~~~~~~~~~
selling_rna.cpp:17:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i=0; i<s2.size(); i++){
      |                  ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 3420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 427 ms 5680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1508 ms 3416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 3420 KB Output isn't correct
2 Halted 0 ms 0 KB -