제출 #202588

#제출 시각아이디문제언어결과실행 시간메모리
202588detaomegaLampice (COCI19_lampice)C++14
25 / 110
518 ms632 KiB
#include <bits/stdc++.h>
using namespace std;  
#define IOS ios::sync_with_stdio(0);cin.tie(0);  
#define int long long  
#define X first  
#define Y second  
#define rep(i,a,b) for(int i=a;i<=b;i++)  
#define int long long  
#define de(x,y) cout<<#x<<" "<<x<<y;  
#define pray(a,i,n_thing) for(int x=i;x<=(i+n_thing);x++) cout<<#a<<"["<<x<<"] :"<<a[x]<<endl;  
#define mem(aa,x) memset(aa,x,sizeof aa)  
#define pb push_back  
typedef long long ll;  
typedef pair<int,int> ii;  
const int maxn=4e5+5;  
int arr[maxn];  

main() {
	IOS  
	int n;
	cin >> n;
	
   
        string s;  
        cin >> s;  
        int ans = 1 , len = s.size();  
        for(int i=0;i<s.size()-1;i++) {  
            int tmp = 1;  
            for(int j=1;j<=s.size();j++) {  
                if(i-j < 0 || i+j >= len)   
                    break;  
                if(s[i - j] != s[i + j])  
                    break;  
                tmp += 2;  
            }  
            ans = max(ans , tmp);  
            if(s[i] == s[i+1]) {  
                tmp = 2;  
                for(int j=1;j<=s.size();j++) {  
                if(i-j < 0 || i+j+1 >= len)   
                    break;  
                if(s[i - j] != s[i + j+1])  
                    break;  
                tmp += 2;  
                }  
            }  
            ans = max(ans , tmp);  
            if(ans == len)  
                break;  
        }  
        cout << ans << "\n";  
        return 0;
}  

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

lampice.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
lampice.cpp: In function 'int main()':
lampice.cpp:27:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<s.size()-1;i++) {  
                     ~^~~~~~~~~~~
lampice.cpp:29:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int j=1;j<=s.size();j++) {  
                         ~^~~~~~~~~~
lampice.cpp:39:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for(int j=1;j<=s.size();j++) {  
                             ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...