답안 #202587

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
202587 2020-02-17T08:08:26 Z detaomega Lampice (COCI19_lampice) C++14
0 / 110
5 ms 376 KB
#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  
   
        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;
}  

Compilation message

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:24:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<s.size()-1;i++) {  
                     ~^~~~~~~~~~~
lampice.cpp:26:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int j=1;j<=s.size();j++) {  
                         ~^~~~~~~~~~
lampice.cpp:36:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for(int j=1;j<=s.size();j++) {  
                             ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -