제출 #555035

#제출 시각아이디문제언어결과실행 시간메모리
555035MrDebooPalindromes (APIO14_palindrome)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template<int MOD> struct ModInt { unsigned x; ModInt() : x(0) { } ModInt(signed sig) : x(sig%MOD) { } ModInt(signed long long sig) : x(sig%MOD) { } int get() const { return (int)x; } ModInt pow(long long p) { ModInt res = 1, a = *this; while (p) { if (p & 1) res *= a; a *= a; p >>= 1; } return res; } ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; } ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; } ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; } ModInt &operator/=(ModInt that) { return (*this) *= that.pow(MOD - 2); } ModInt operator+(ModInt that) const { return ModInt(*this) += that; } ModInt operator-(ModInt that) const { return ModInt(*this) -= that; } ModInt operator*(ModInt that) const { return ModInt(*this) *= that; } ModInt operator/(ModInt that) const { return ModInt(*this) /= that; } bool operator<(ModInt that) const { return x < that.x; } friend ostream& operator<<(ostream &os, ModInt a) { os << a.x; return os; } }; #define send {ios_base::sync_with_stdio(false);} #define help {cin.tie(NULL); cout.tie(NULL);} #define fs first #define sc second #define unique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());} #define endl '\n' #define sz(x) ((int)x.size()) #define all(a) (a).begin(), (a).end() typedef long long ll; typedef long double ld; typedef ModInt<1000000007> mint; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset; const int mxn=200000; const ll mod=1000000007; const ll INF=1000000000000000000; template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) { cin >> p.fs; return cin >> p.sc; } string FileS=""; bool tstc=0; void dothethingthatfindsthesolutiontotheproblem(){ string s; cin>>s; vector<char>c; for(auto &i:s)c.push_back(i); PolyHash h=PolyHash(c); unordered_map<ll,ll>mp; ll ans=0; for(int i=0;i<sz(s);i++){; for(int w=i;w<sz(s);w++){ mp[h.get_hash(i,w)]++; } } for(int i=0;i<sz(s);i++){ int l=i,r=i; while(l>=0&&r<sz(s)&&s[l]==s[r]){ ans=max(ans,mp[h.get_hash(l,r)]*(r-l+1)); r++; l--; } } for(int i=1;i<sz(s);i++){ int l=i-1,r=i; while(l>=0&&r<sz(s)&&s[l]==s[r]){ ans=max(ans,mp[h.get_hash(l,r)]*(r-l+1)); r++; l--; } } cout<<ans; } void File(){ ifstream cin(FileS + ".in"); ofstream cout(FileS + ".out"); } int main(){ send help if(FileS.size())File(); int tc=1; if(tstc)cin>>tc; while(tc--){ dothethingthatfindsthesolutiontotheproblem(); } }

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

palindrome.cpp: In function 'void dothethingthatfindsthesolutiontotheproblem()':
palindrome.cpp:62:5: error: 'PolyHash' was not declared in this scope
   62 |     PolyHash h=PolyHash(c);
      |     ^~~~~~~~
palindrome.cpp:67:16: error: 'h' was not declared in this scope
   67 |             mp[h.get_hash(i,w)]++;
      |                ^
palindrome.cpp:73:28: error: 'h' was not declared in this scope
   73 |             ans=max(ans,mp[h.get_hash(l,r)]*(r-l+1));
      |                            ^
palindrome.cpp:81:28: error: 'h' was not declared in this scope
   81 |             ans=max(ans,mp[h.get_hash(l,r)]*(r-l+1));
      |                            ^