답안 #332607

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
332607 2020-12-03T01:22:42 Z Kevin_Zhang_TW Selling RNA Strands (JOI16_selling_rna) C++17
10 / 100
1500 ms 21868 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb emplace_back
#define AI(i) begin(i), end(i)
template<class T>
bool chmax(T &v, T val) { return v < val ? (v = val, true) : false; }
template<class T>
bool chmin(T &v, T val) { return val < v ? (v = val, true) : false; }

#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] = "), kout(args)
void kout() { cerr << endl; }
template<class T, class ...U>
void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
template<class T>
void debug(T L, T R) { while (L != R) cerr << *L << " \n"[next(L) == R], ++L; }
#else
#define DE(...) 0
#define debug(...) 0
#endif

const int MAX_N = 100010;

int n, m;
string w[MAX_N], p[MAX_N], q[MAX_N];

int32_t main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> m;
	for (int i = 0;i < n;++i)
		cin >> w[i];
	for (int i = 0;i < m;++i)
		cin >> p[i] >> q[i];

	for (int i = 0;i < m;++i) {
		int res = 0;
		for (int j = 0;j < n;++j) {
			if (max(p[i].size(), q[i].size()) > w[j].size()) continue;
			res += p[i] == w[j].substr(0, p[i].size()) &&
			   	q[i] == w[j].substr(w[j].size() - q[i].size());
		}
		cout << res << '\n';
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 9708 KB Output is correct
2 Correct 7 ms 9728 KB Output is correct
3 Correct 7 ms 9708 KB Output is correct
4 Correct 6 ms 9708 KB Output is correct
5 Correct 7 ms 9708 KB Output is correct
6 Correct 7 ms 9728 KB Output is correct
7 Correct 7 ms 9708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 260 ms 18028 KB Output is correct
2 Correct 1035 ms 18156 KB Output is correct
3 Correct 302 ms 17912 KB Output is correct
4 Correct 399 ms 18156 KB Output is correct
5 Correct 852 ms 15212 KB Output is correct
6 Correct 843 ms 15084 KB Output is correct
7 Correct 822 ms 21100 KB Output is correct
8 Execution timed out 1589 ms 21868 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1583 ms 10220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 9708 KB Output is correct
2 Correct 7 ms 9728 KB Output is correct
3 Correct 7 ms 9708 KB Output is correct
4 Correct 6 ms 9708 KB Output is correct
5 Correct 7 ms 9708 KB Output is correct
6 Correct 7 ms 9728 KB Output is correct
7 Correct 7 ms 9708 KB Output is correct
8 Correct 260 ms 18028 KB Output is correct
9 Correct 1035 ms 18156 KB Output is correct
10 Correct 302 ms 17912 KB Output is correct
11 Correct 399 ms 18156 KB Output is correct
12 Correct 852 ms 15212 KB Output is correct
13 Correct 843 ms 15084 KB Output is correct
14 Correct 822 ms 21100 KB Output is correct
15 Execution timed out 1589 ms 21868 KB Time limit exceeded
16 Halted 0 ms 0 KB -