提出 #46583112
ソースコード 拡げる
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
//template
using ll = long long;
using ull = unsigned long long;
const int inf = INT_MAX/2;
const ll infl = LONG_MAX/2;
#define OVERLOAD(e1, e2, e3, e4, NAME, ...) NAME
#define REP1(i, b) for (ll i = 0, i##_len = ll(b); i < i##_len; i++)
#define REP2(i, a, b) for (ll i = ll(a), i##_len = ll(b); i < i##_len; i++)
#define REP3(i, a, b, c) for (ll i = ll(a), i##_len = ll(b); i < i##_len; i += ll(c))
#define rep(...) OVERLOAD(__VA_ARGS__, REP3, REP2, REP1)(__VA_ARGS__)
#define REPS1(i, b) for (ll i = 0, i##_len = ll(b); i <= i##_len; i++)
#define REPS2(i, a, b) for (ll i = ll(a), i##_len = ll(b); i <= i##_len; i++)
#define REPS3(i, a, b, c) for (ll i = ll(a), i##_len = ll(b); i <= i##_len; i += ll(c))
#define reps(...) OVERLOAD(__VA_ARGS__, REPS3, REPS2, REPS1)(__VA_ARGS__)
#define RREP1(i, a) for (ll i = ll(a); i >= 0; i--)
#define RREP2(i, a, b) for (ll i = ll(a), i##_len = ll(b); i >= i##_len; i--)
#define RREP3(i, a, b, c) for (ll i = ll(a), i##_len = ll(b); i >= i##_len; i -= ll(c))
#define rrep(...) OVERLOAD(__VA_ARGS__, RREP3, RREP2, RREP1)(__VA_ARGS__)
#define vrep(i, vec) for (auto &i: vec)
#define all(x) (x).begin(), (x).end()
#define Yes(bool) if(bool) {println("Yes");} else {println("No");}
const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117;
template<class T> double rad(const T theta) { return theta*pi/180; }
ll mpow(ll x, ll n) { ll ret = 1; while (n > 0) { if (n & 1) ret *= x; x *= x; n >>= 1; } return ret; }
void printd() { cout << '\n'; } template<class T, class... Ts> void printd(const T& a, const Ts&... b) { cout << setprecision(20) << a; if (sizeof...(b) != 0) {cout << ' ';}; printd(b...); }
void println() { cout << '\n'; } template<class T, class... Ts> void println(const T& a, const Ts&... b) { cout << a; if (sizeof...(b) != 0) {cout << ' ';}; println(b...); }
void print() {} template<class T, class... Ts> void print(const T& a, const Ts&... b) { cout << a; if (sizeof...(b) != 0) {cout << ' ';}; print(b...); }
template<class T> void printv(const T vec) { int i = 0; int s = vec.size(); vrep(v, vec) { print(v); i++; if (i != s) print(' '); } println(); }
template<class T> void printvv(const T vec) { vrep(v, vec) { printv(v); } }
void in() {} template<class T, class... Ts> void in(T& a, Ts&... b) { cin >> a; in(b...); }
int lcs(string S, string T) {
int ls = S.size();
int lt = T.size();
int dp[ls+1][lt+1];
rep(t, 0, lt+1) {
rep(s, 0, ls+1) {
if (s == 0 || t == 0) {
dp[s][t] = 0;
} else if (S[s-1] == T[t-1]) {
dp[s][t] = dp[s-1][t-1] + 1;
} else {
dp[s][t] = max(dp[s-1][t], dp[s][t-1]);
}
}
}
return dp[ls][lt];
}
int main() {
int N;
string T;
in(N, T);
string S[N];
rep(i, N) in(S[i]);
ll cnt = 0;
rep(i, N) {
rep(j, N) {
if (lcs(T, S[i]+S[j]) == T.size()) {
cnt++;
}
}
}
println(cnt);
return 0;
}
提出情報
コンパイルエラー
Main.cpp: In function ‘int main()’:
Main.cpp:74:35: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
74 | if (lcs(T, S[i]+S[j]) == T.size()) {
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
0 / 500 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
example0.txt, example1.txt, example2.txt, example3.txt |
| All |
000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, example0.txt, example1.txt, example2.txt, example3.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 000.txt |
TLE |
2208 ms |
18948 KiB |
| 001.txt |
TLE |
2208 ms |
18940 KiB |
| 002.txt |
TLE |
2207 ms |
4088 KiB |
| 003.txt |
TLE |
2207 ms |
4800 KiB |
| 004.txt |
TLE |
2208 ms |
9632 KiB |
| 005.txt |
TLE |
2208 ms |
13832 KiB |
| 006.txt |
RE |
488 ms |
1054300 KiB |
| 007.txt |
RE |
489 ms |
1054340 KiB |
| 008.txt |
AC |
1 ms |
3432 KiB |
| 009.txt |
TLE |
2211 ms |
18920 KiB |
| 010.txt |
TLE |
2207 ms |
7032 KiB |
| 011.txt |
TLE |
2208 ms |
10856 KiB |
| 012.txt |
TLE |
2207 ms |
5024 KiB |
| 013.txt |
TLE |
2207 ms |
4988 KiB |
| 014.txt |
TLE |
2207 ms |
6864 KiB |
| 015.txt |
TLE |
2210 ms |
4292 KiB |
| 016.txt |
TLE |
2207 ms |
4636 KiB |
| 017.txt |
TLE |
2207 ms |
4308 KiB |
| 018.txt |
TLE |
2210 ms |
5216 KiB |
| 019.txt |
TLE |
2207 ms |
4148 KiB |
| 020.txt |
TLE |
2207 ms |
4168 KiB |
| 021.txt |
TLE |
2207 ms |
4336 KiB |
| 022.txt |
TLE |
2208 ms |
13516 KiB |
| 023.txt |
TLE |
2208 ms |
16436 KiB |
| 024.txt |
AC |
142 ms |
4460 KiB |
| 025.txt |
AC |
563 ms |
4952 KiB |
| 026.txt |
TLE |
2208 ms |
10868 KiB |
| 027.txt |
TLE |
2212 ms |
79272 KiB |
| 028.txt |
TLE |
2218 ms |
197604 KiB |
| 029.txt |
TLE |
2255 ms |
832092 KiB |
| 030.txt |
AC |
30 ms |
6512 KiB |
| 031.txt |
AC |
135 ms |
4776 KiB |
| 032.txt |
TLE |
2208 ms |
10892 KiB |
| 033.txt |
TLE |
2219 ms |
202716 KiB |
| 034.txt |
RE |
480 ms |
1052684 KiB |
| 035.txt |
TLE |
2260 ms |
981060 KiB |
| 036.txt |
RE |
483 ms |
1052812 KiB |
| 037.txt |
TLE |
2209 ms |
25988 KiB |
| 038.txt |
TLE |
2209 ms |
25832 KiB |
| 039.txt |
TLE |
2209 ms |
25984 KiB |
| example0.txt |
AC |
1 ms |
3548 KiB |
| example1.txt |
AC |
1 ms |
3536 KiB |
| example2.txt |
AC |
1 ms |
3512 KiB |
| example3.txt |
AC |
1 ms |
3428 KiB |