답안 #875779

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
875779 2023-11-20T13:21:00 Z Nurislam Selling RNA Strands (JOI16_selling_rna) C++14
0 / 100
1287 ms 1048576 KB
#include <bits/stdc++.h>
using namespace std;
/*
<<<<It's never too late for a new beginning in your life>>>>
Today is hard
  tomorrow will worse
  but the day after tomorrow will be the sunshine..

HARD WORK BEATS TALENT WHEN TALENT DOESN'T WORK HARD............
Never give up  */

//The most CHALISHKANCHIK
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define int long long
void solve(){
	map<string, int> mp, mps;
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		string res1 = "";
		for(int i = 0; i < (int)s.size(); i++){
			res1+=s[i];
			mp[res1]++;
		}
		res1 = "";
		for(int i = (int)s.size()-1; i >= 0; i--){
			res1+=s[i];
			mps[res1]++;
		}
	}
	for(int i = 0; i < m; i++){
		string a, b;
		cin >> a >> b;
		cout << min(mp[a], mps[b]) << '\n';	
	}
}
main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int t = 1;
	//~ cin >> t;
	while(t--){
		solve();
	}
}








Compilation message

selling_rna.cpp:43:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   43 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1287 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 1116 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -