Submission #51643

#TimeUsernameProblemLanguageResultExecution timeMemory
51643okaybody10구간 성분 (KOI15_interval)C++98
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <set> #pragma GCC optimize(Ofast) using namespace std; typedef vector<int> vi; set<vi> gg; int main() { char s1[1605],s2[1605]; scanf("%s %s",s1,s2); int l1=strlen(s1),l2=strlen(s2); for(int i=l1;i>0;i--) { vi alpha(26); int s=0,e=i-1; for(int j=s;j<=e;j++) alpha[s1[j]-'a']++; while(e<l1) { gg.insert(alpha); if(++e<l1) alpha[s1[e]-'a']++,alpha[s1[s++]-'a']--; } } for(int i=l2;i>0;i--) { vi alpha(26); int s=0,e=i-1; for(int j=s;j<=e;j++) alpha[s2[j]-'a']++; while(e<l2) { if(gg.find(alpha) != gg.end()) { return !printf("%d",i);} if(++e<l2) alpha[s2[e]-'a']++,alpha[s2[s++]-'a']--; } } printf("0"); return 0; }

Compilation message (stderr)

interval.cpp:4:22: warning: '#pragma GCC optimize' is not a string or number [-Wpragmas]
 #pragma GCC optimize(Ofast)
                      ^~~~~
interval.cpp: In function 'int main()':
interval.cpp:12:12: error: 'strlen' was not declared in this scope
     int l1=strlen(s1),l2=strlen(s2);
            ^~~~~~
interval.cpp:12:12: note: suggested alternative: 'mbrlen'
     int l1=strlen(s1),l2=strlen(s2);
            ^~~~~~
            mbrlen
interval.cpp:24:15: error: 'l2' was not declared in this scope
     for(int i=l2;i>0;i--)
               ^~
interval.cpp:24:15: note: suggested alternative: 'l1'
     for(int i=l2;i>0;i--)
               ^~
               l1
interval.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s %s",s1,s2);
     ~~~~~^~~~~~~~~~~~~~~