제출 #1112729

#제출 시각아이디문제언어결과실행 시간메모리
1112729vjudge1Savez (COCI15_savez)C++17
120 / 120
330 ms13384 KiB
#include <bits/stdc++.h> using namespace std; unordered_map<string,int> mapa; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin>>n; int res=0; for(;n>0;n--) { string s; cin>>s; int temp=0; string s1=""; for(int i=0;i<s.size();i++) { s1.push_back(s[i]); if(s1==s.substr(s.size()-i-1,i+1)) { temp=max(temp,mapa[s1]+1); } } mapa[s]=max(mapa[s],temp); res=max(res,temp); } cout<<res; return 0; }

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

savez.cpp: In function 'int main()':
savez.cpp:21:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         for(int i=0;i<s.size();i++)
      |                     ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...