Submission #94810

#TimeUsernameProblemLanguageResultExecution timeMemory
94810quoriessRima (COCI17_rima)C++14
42 / 140
358 ms18876 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef pair<lli,lli> pii; #define dbg(x) cout<<#x<<" has a value of: "<<x<<"\n"; #define usize(x) (int)(x.size()) #define plist(x) for(int i=0;i<usize(x);i++)cout<<"eleman "<<i<<" = "<<x[i]<<"\n"; #define foreach(x) for(auto item:x) #define fill(s,x) for(int i=0;i<x;i++)cin>>s[i]; #define in(veriler,a) (veriler.find(a)!=veriler.end()) #define btw(x,y,z) x>=y && x<=z std::ostream& operator<<(std::ostream& os, pair<int,int> p) { os << p.first << ", " << p.second; return os; } int main(){ int n; cin>>n; vector<string> dizi; for (int i = 0; i < n; i++) { string s; cin>>s; reverse(s.begin(),s.end()); dizi.push_back(s); } sort(dizi.begin(),dizi.end()); int mc=1; int mx=1; for (int i = 1; i < n; i++) { int k1=0,k2=0; while(k1<(int)dizi[i-1].size()&&k2<(int)dizi[i].size()&&dizi[i-1][k1]==dizi[i][k2]){ k1++; k2++; } if(k2==(int)dizi[i].size()||(k2>0&&k2==(int)dizi[i].size()-1)){ mc++; mx=max(mc,mx); } else{ mc=1; } } cout<<mx<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...