제출 #1029761

#제출 시각아이디문제언어결과실행 시간메모리
1029761earlyamazonSavez (COCI15_savez)C++14
0 / 120
1091 ms2644 KiB
// brut n <= 20, S <= 500 #include <bits/stdc++.h> using namespace std; const int mn = 503; int n,wyn; string t[mn]; bool ok[mn][mn]; bool czy1w2(string s1, string s2){ if (s1.size() > s2.size()) return 0; for (int i = 0; i < s1.size(); i++){ if (s1[i] != s2[i] || s1[s1.size()-i-1] != s2[s2.size()-i-1]) return 0; } return 1; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for (int i = 0; i < n; i++){ cin>>t[i]; } for (int i = 0; i < n; i++){ for (int j = i+1; j < n; j++){ if (czy1w2(t[i], t[j])){ ok[i][j] = 1; } } } for (int i = 1; i < (1<<n); i++){ vector<int> kt; for (int j = 0; j < n; j++){ if ((1<<j)&i) kt.push_back(j); } bool czyok = 1; for (int j = 1; j < kt.size(); j++){ if (!ok[kt[j-1]][kt[j]]) czyok = 0; } if (czyok) wyn = max(wyn, (int)kt.size()); } cout<<wyn<<"\n"; }

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

savez.cpp: In function 'bool czy1w2(std::string, std::string)':
savez.cpp:14:23: 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 i = 0; i < s1.size(); i++){
      |                     ~~^~~~~~~~~~~
savez.cpp: In function 'int main()':
savez.cpp:39:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for (int j = 1; j < kt.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...
#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...