Submission #365418

#TimeUsernameProblemLanguageResultExecution timeMemory
365418BartolMSelling RNA Strands (JOI16_selling_rna)C++17
10 / 100
2 ms1132 KiB
#include <bits/stdc++.h> using namespace std; #define X first #define Y second #define mp make_pair #define pb push_back typedef long long ll; typedef pair <int, int> pii; typedef pair <int, pii> pip; typedef pair <pii, int> ppi; typedef pair <ll, ll> pll; typedef pair <pii, pii> ppp; const int INF=0x3f3f3f3f; const int N=105; const int MAX=2e6+5; int n, q, len; char inp[N]; string str; string s[N]; int cnt[N]; void solve() { for (int i=0; i<q; ++i) { memset(cnt, 0, sizeof cnt); scanf("%s", inp); str=inp; for (int j=0; j<n; ++j) { if (str.size()>s[j].size()) continue; if (s[j].substr(0, str.size())==str) ++cnt[j]; } scanf("%s", inp); str=inp; int res=0; for (int j=0; j<n; ++j) { if (str.size()>s[j].size()) continue; if (s[j].substr((int)s[j].size()-(int)str.size(), str.size())==str) ++cnt[j]; if (cnt[j]==2) ++res; } printf("%d\n", res); } } void load() { scanf("%d %d", &n, &q); for (int i=0; i<n; ++i) { scanf("%s", inp); s[i]=inp; } } int main() { load(); solve(); return 0; }

Compilation message (stderr)

selling_rna.cpp: In function 'void solve()':
selling_rna.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   29 |         scanf("%s", inp);
      |         ~~~~~^~~~~~~~~~~
selling_rna.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   35 |         scanf("%s", inp);
      |         ~~~~~^~~~~~~~~~~
selling_rna.cpp: In function 'void load()':
selling_rna.cpp:48:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   48 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~
selling_rna.cpp:50:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   50 |         scanf("%s", inp);
      |         ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...