Submission #875780

# Submission time Handle Problem Language Result Execution time Memory
875780 2023-11-20T13:27:32 Z Nurislam Selling RNA Strands (JOI16_selling_rna) C++14
35 / 100
1291 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<pair<string, string> , int> mp;
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		for(int k = 0; k < (int)s.size(); k++){
			for(int j = 0; j < (int)s.size(); j++){
				mp[{s.substr(0, k+1), s.substr(j)}]++;
			}
		}
	}
	for(int i = 0; i < m; i++){
		string a, b;
		cin >> a >> b;
		cout << mp[{a,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:38:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   38 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 456 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1291 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 592 KB Output is correct
2 Correct 226 ms 6952 KB Output is correct
3 Correct 151 ms 3664 KB Output is correct
4 Correct 37 ms 1048 KB Output is correct
5 Correct 193 ms 6932 KB Output is correct
6 Correct 151 ms 3728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 456 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Runtime error 1291 ms 1048576 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -