제출 #1042236

#제출 시각아이디문제언어결과실행 시간메모리
1042236milo_milkshakeSelling RNA Strands (JOI16_selling_rna)C++14
10 / 100
1559 ms11392 KiB
#include <bits/stdc++.h> using namespace std; #define uwu "RNA" typedef long long ll; #define pb push_back #define endl '\n' #define FOR(i, a, b) for(int i = a; i <= b; i++) #define FORD(i, a, b) for(int i = a; i >= b; i--) const int N = 1e5 + 3; const int M = 2e6 + 2; const int INF = 1e9 + 7; int n, q; string s[N]; bool pre(const string& a, const string& b){ if (a.size() > b.size()) return 0; FOR(i, 0, (int) a.size() - 1) if (a[i] != b[i]) return 0; return 1; } bool suf(const string& a, const string& b){ int l1 = a.size(), l2 = b.size(); if (l1 > l2) return 0; FOR(i, 0, l1 - 1) if (a[i] != b[l2 - l1 + i]) return 0; return 1; } void solve(void){ while(q--){ string P, S; cin >> P >> S; int res = 0; FOR(i, 1, n) if (pre(P, s[i]) && suf(S, s[i])) res++; cout << res << endl; } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(uwu".inp","r")){ freopen(uwu".inp","r",stdin); freopen(uwu".out","w",stdout); } cin >> n >> q; FOR(i, 1, n) cin >> s[i]; solve(); cerr << "\nTime used: " << clock() << "ms\n"; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

selling_rna.cpp: In function 'int main()':
selling_rna.cpp:40:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |         freopen(uwu".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
selling_rna.cpp:41:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |         freopen(uwu".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...