제출 #707777

#제출 시각아이디문제언어결과실행 시간메모리
707777TAhmed33Miners (IOI07_miners)C++98
45 / 100
1592 ms524288 KiB
#include <bits/stdc++.h> using namespace std; int n; string s; int ans (int pos, vector <char> mine1, vector <char> mine2) { if (pos == n) { return 0; } mine1.push_back(s[pos]); int val = 0; map <char, int> ds; for (int i = (int)mine1.size() - 1; i >= max(0, (int)mine1.size() - 3); i--) { ds[mine1[i]]++; } int ret = ans(pos + 1, mine1, mine2) + (int)ds.size(); ds.clear(); mine1.pop_back(); mine2.push_back(s[pos]); for (int i = (int)mine2.size() - 1; i >= max(0, (int)mine2.size() - 3); i--) { ds[mine2[i]]++; } ret = max(ret, ans(pos + 1, mine1, mine2) + (int)ds.size()); return ret; } int main () { cin >> n >> s; cout << ans(0, {}, {}); }

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

miners.cpp: In function 'int ans(int, std::vector<char>, std::vector<char>)':
miners.cpp:10:6: warning: unused variable 'val' [-Wunused-variable]
   10 |  int val = 0;
      |      ^~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...