Submission #359349

#TimeUsernameProblemLanguageResultExecution timeMemory
359349aZvezdaSelling RNA Strands (JOI16_selling_rna)C++14
10 / 100
1534 ms37796 KiB
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize ("O3") //#pragma GCC target ("sse4") #define endl "\n" typedef long long ll; template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) { out << x.first << " " << x.second; return out;} template<class T, class T2> inline istream &operator >>(istream &in, pair<T, T2> &x) { in >> x.first >> x.second; return in;} template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; } template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; } const ll mod = 1e9 + 7; #define out(x) "{" << (#x) << ": " << x << "} " const int MAX_N = 1e6 + 01; string in[MAX_N]; bool eval(int ind, string st, string en) { for(int i = 0; i < st.size(); i ++) { if(in[ind][i] != st[i]) { return false; } } for(int i = 0; i < en.size(); i ++) { if(in[ind][in[ind].size() - en.size() + i] != en[i]) { return false; } } return true; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m; cin >> n >> m; for(int i = 0; i < n; i ++) { cin >> in[i]; } for(int i = 0; i < m; i ++) { string st, en; cin >> st >> en; int cnt = 0; for(int j = 0; j < n; j ++) { cnt += eval(j, st, en); } cout << cnt << endl; } return 0; }

Compilation message (stderr)

selling_rna.cpp: In function 'bool eval(int, std::string, std::string)':
selling_rna.cpp:18:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i = 0; i < st.size(); i ++) {
      |                    ~~^~~~~~~~~~~
selling_rna.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i = 0; i < en.size(); i ++) {
      |                    ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...