제출 #670387

#제출 시각아이디문제언어결과실행 시간메모리
670387nolimiyaPalindromic Partitions (CEOI17_palindromic)C++14
0 / 100
35 ms70740 KiB
#include <bits/stdc++.h> #include <math.h> //in the name of god,aka allah //**gray sety orz** #pragma GCC optimize("unroll-loops") using namespace std; #define pi pair<long long , long long> #define pii pair<long long , pair<long long , long long>> const int maxm =1e6 + 5; long long aval = 27; const long long mod = 1e9 + 7 ; typedef long long ll; ll l,r,mid; ll n,m; ll dis[maxm] , sum[maxm]; bool isval(int mid){ //cout << mid <<" " << mid*mid-mid <<endl; if (((mid-1)*mid)/2 < m) return 0; return 1; } int darage[maxm] , ss , mm; queue<int> q; vector<pi> g[maxm] , z[maxm]; ll sath[maxm]; bool vis[maxm] , gos[maxm]; int pedaret[maxm]; ll get_par(ll v){ if (pedaret[v]==v) return v; return pedaret[v] = get_par(pedaret[v]); } void merge(ll r , ll q){ if (get_par(r)!=get_par(q))l+=max(darage[r],darage[q])*1ll*sath[r]*1ll*sath[q]; r = get_par(r) , q = get_par(q); if (r!=q){ if (sath[r]<sath[q]) swap(r,q); pedaret[q] = r; sath[r] += sath[q]; } return ; } ll pars1[maxm] , pars2[maxm]; vector<ll> se[maxm]; set<pi> st; int rp[maxm]; pi w[maxm]; int dp[maxm]; //ll rw[maxm][maxm]; map<ll,ll> mp; void solve(){ string s; cin >>s; l = 0 , r = 0 , mid = 0 , ss = 1; for (int i=0; i<=s.size()/2-1; i++){ l*=aval , l%=mod; l+=(s[i]-'a'+1); l%=mod; r+=(((s[s.size()-1-i]-'a')+1)*ss); r%=mod; ss*=aval; ss%=mod; if (l==r) mid+=2 , ss = 1 , l = 0 , r = 0; } if (l!=0 || s.size()%2) mid++; cout<<mid<<endl; } int main() { ios::sync_with_stdio (0), cin.tie (0), cout.tie (0); int t; cin >>t; while (t--){ solve(); } }

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

palindromic.cpp: In function 'void solve()':
palindromic.cpp:53:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |  for (int i=0; i<=s.size()/2-1; i++){
      |                ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...