Submission #321001

#TimeUsernameProblemLanguageResultExecution timeMemory
321001tjdgus4384구간 성분 (KOI15_interval)C++14
38 / 100
438 ms131076 KiB
#include<bits/stdc++.h> using namespace std; string s1, s2; vector<int> v(30, 0), t(30, 0); set<vector<int> > s; int main(){ cin >> s1 >> s2; for(int i = 1;i < s1.size();i++){ for(int j = 0;j < i;j++){ v[s1[j]-'a']++; } s.insert(v); for(int j = i;j < s1.size();j++){ v[s1[j-i]-'a']--; v[s1[j]-'a']++; s.insert(v); } for(int j = 0;j < 30;j++) v[j] = 0; } for(int i = s2.size()-1;i > 0;i--){ for(int j = 0;j < i;j++){ t[s2[j]-'a']++; } if(s.count(t)){ printf("%d", i); return 0; } for(int j = i;j < s1.size();j++){ t[s2[j-i]-'a']--; t[s2[j]-'a']++; if(s.count(t)){ printf("%d", i); return 0; } } for(int j = 0;j < 30;j++) t[j] = 0; } printf("0"); return 0; }

Compilation message (stderr)

interval.cpp: In function 'int main()':
interval.cpp:9:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i = 1;i < s1.size();i++){
      |                   ~~^~~~~~~~~~~
interval.cpp:14:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for(int j = i;j < s1.size();j++){
      |                       ~~^~~~~~~~~~~
interval.cpp:28:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for(int j = i;j < s1.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...