제출 #1008001

#제출 시각아이디문제언어결과실행 시간메모리
1008001vjudge1Miners (IOI07_miners)C++17
45 / 100
833 ms860 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> using namespace std; const int N = 2e5+1; int n; string s; int main() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); cin >> n >> s; if (n <= 20) { int sol = 0; for (int msk = 0; msk < (1 << n); msk++) { int coal = 0; vector<int> fr, sc; for (int i = 0; i < n; i++) { if (msk>>i&1) swap(fr, sc); fr.push_back(s[i]); if (fr.size() == 1) coal += 1; else if (fr.size() == 2) coal += 1+(fr[1] != fr[0]); else { set<int> cc; cc.insert(fr[fr.size()-1]); cc.insert(fr[fr.size()-2]); cc.insert(fr[fr.size()-3]); coal += cc.size(); } if (msk>>i&1) swap(fr, sc); } sol = max(sol, coal); } cout << sol; return 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...