Submission #1086301

#TimeUsernameProblemLanguageResultExecution timeMemory
1086301toast12Laugh Analysis (IOI16_laugh)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector<int> pos; for (int i = 0; i < int(s.length()); i++) { if (s[i] == 'a' || s[i] == 'h') pos.push_back(i); } int l = pos[0], r = pos[0]; int ans = 0; int cur = 1; while (r < int(s.length())) { if (pos[cur]-r > 1) { ans = max(ans, r-l+1); l = r = pos[cur]; cur++; } else { if (s[pos[cur]] == s[r]) { ans = max(ans, r-l+1); l = r = pos[cur]; cur++; } else { r++; ans = max(ans, r-l+1); cur++; } } } cout << ans << '\n'; return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccbyxJ5O.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccc7HZYP.o:laugh.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccbyxJ5O.o: in function `main':
grader.cpp:(.text.startup+0x65): undefined reference to `longest_laugh(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status