# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1008001 |
2024-06-26T05:37:58 Z |
vjudge1 |
Miners (IOI07_miners) |
C++17 |
|
833 ms |
860 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
440 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
90 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
493 ms |
428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
833 ms |
444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
860 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |