Submission #329815

#TimeUsernameProblemLanguageResultExecution timeMemory
329815theshadow_04Selling RNA Strands (JOI16_selling_rna)C++14
10 / 100
2 ms1004 KiB
// V T An #include <bits/stdc++.h> #define F first #define S second #define MOD 1000000007 #define pb push_back #define ll long long #define Task "SELLINGRNA" using namespace std; const int maxn = 105; int n, m, len[maxn]; string s[maxn]; int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); if(fopen(Task".inp", "r")){ freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } cin >> n >> m; for(int i = 1; i <= n; ++i) { cin >> s[i]; len[i] = s[i].length(); s[i] = " " + s[i]; } for(int i = 1; i <= m; ++i) { int ans = 0; string p, q; cin >> p >> q; for(int j = 1; j <= n; ++ j) { if(len[j] < q.size() || len[j] < p.size()) continue; string cur = s[j].substr(1, (int) p.size()); if(cur != p) continue; cur = s[j].substr(len[j] - q.size() + 1, (int) q.size()); if(cur == q) ans ++; } cout << ans << "\n"; } } // CHY-AKAV

Compilation message (stderr)

selling_rna.cpp: In function 'int main()':
selling_rna.cpp:34:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |             if(len[j] < q.size() || len[j] < p.size()) continue;
      |                ~~~~~~~^~~~~~~~~~
selling_rna.cpp:34:44: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |             if(len[j] < q.size() || len[j] < p.size()) continue;
      |                                     ~~~~~~~^~~~~~~~~~
selling_rna.cpp:21:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   21 |   freopen(Task".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
selling_rna.cpp:22:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   22 |   freopen(Task".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...