제출 #395933

#제출 시각아이디문제언어결과실행 시간메모리
395933ArshiaDadras원형 문자열 (IZhO13_rowords)C++14
컴파일 에러
0 ms0 KiB
if (s[i - 1] == t[(j - 1) % m]) { dp[i][j] = dp[i - 1][j - 1] + 1; par[i][j] = 2; } else { dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]); par[i][j] = dp[i][j] > dp[i - 1][j]; } } int calc_round_lcs() { int answer = 0; for (int i = 0; i < m; i++) answer = max(answer, calc_lcs(m + i)); return answer; } void read_input() { cin >> s >> t; n = s.size(); m = t.size(); } void solve() { int answer = 0; for (int i = 0; i < 2; i++) { build_dp(); reverse(t.begin(), t.end()); answer = max(answer, calc_round_lcs()); } cout << answer; } int main() { ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0); read_input(), solve(); return 0; }

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

rowords.cpp:1:4: error: expected unqualified-id before 'if'
    1 |    if (s[i - 1] == t[(j - 1) % m]) {
      |    ^~
rowords.cpp:5:4: error: expected unqualified-id before 'else'
    5 |    else {
      |    ^~~~
rowords.cpp:9:1: error: expected declaration before '}' token
    9 | }
      | ^
rowords.cpp: In function 'int calc_round_lcs()':
rowords.cpp:13:22: error: 'm' was not declared in this scope
   13 |  for (int i = 0; i < m; i++)
      |                      ^
rowords.cpp:14:24: error: 'calc_lcs' was not declared in this scope
   14 |   answer = max(answer, calc_lcs(m + i));
      |                        ^~~~~~~~
rowords.cpp:14:12: error: 'max' was not declared in this scope
   14 |   answer = max(answer, calc_lcs(m + i));
      |            ^~~
rowords.cpp: In function 'void read_input()':
rowords.cpp:19:2: error: 'cin' was not declared in this scope
   19 |  cin >> s >> t;
      |  ^~~
rowords.cpp:19:9: error: 's' was not declared in this scope
   19 |  cin >> s >> t;
      |         ^
rowords.cpp:19:14: error: 't' was not declared in this scope
   19 |  cin >> s >> t;
      |              ^
rowords.cpp:20:2: error: 'n' was not declared in this scope
   20 |  n = s.size();
      |  ^
rowords.cpp:21:2: error: 'm' was not declared in this scope
   21 |  m = t.size();
      |  ^
rowords.cpp: In function 'void solve()':
rowords.cpp:27:3: error: 'build_dp' was not declared in this scope
   27 |   build_dp();
      |   ^~~~~~~~
rowords.cpp:28:11: error: 't' was not declared in this scope
   28 |   reverse(t.begin(), t.end());
      |           ^
rowords.cpp:28:3: error: 'reverse' was not declared in this scope
   28 |   reverse(t.begin(), t.end());
      |   ^~~~~~~
rowords.cpp:29:12: error: 'max' was not declared in this scope
   29 |   answer = max(answer, calc_round_lcs());
      |            ^~~
rowords.cpp:31:2: error: 'cout' was not declared in this scope
   31 |  cout << answer;
      |  ^~~~
rowords.cpp: In function 'int main()':
rowords.cpp:35:2: error: 'ios' has not been declared
   35 |  ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);
      |  ^~~
rowords.cpp:35:28: error: 'cin' was not declared in this scope
   35 |  ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);
      |                            ^~~
rowords.cpp:35:40: error: 'cout' was not declared in this scope
   35 |  ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);
      |                                        ^~~~