# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
520326 | 2022-01-29T13:13:12 Z | MurotY | Miners (IOI07_miners) | C++14 | 1500 ms | 8300 KB |
#include <bits/stdc++.h> #define ll long long #define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ff first #define ss second using namespace std; const int N=1e6+7, M=1e9+7; map <ll,ll> mp; int n; string s; ll ans=0; void dfs(ll x, string a){ mp[x]++; string b; for (int i=0;i<n;i++) if (mp[i] == 0) b=b+s[i]; map <char,ll> mp1; ll res=0; //cout << a << "\n"; for (int i=0;i<a.size();i++){ if (i-1 >= 0) mp1[a[i-1]]=1; if (i-2 >= 0) mp1[a[i-2]]=1; mp1[a[i]]=1; res+=mp1['B']+mp1['F']+mp1['M']; mp1.clear(); } mp1.clear(); for (int i=0;i<b.size();i++){ if (i-1 >= 0) mp1[b[i-1]]=1; if (i-2 >= 0) mp1[b[i-2]]=1; mp1[b[i]]=1; res+=mp1['B']+mp1['F']+mp1['M']; mp1.clear(); } ans=max(ans, res); //if (res == 14) cout << a << " " << b <<"\n"; for (int i=0;i<n;i++){ if (i > x) dfs(i, a+s[i]); } mp[x]--; return ; } int main() { cin >> n >> s; string q; q=q+s[0]; dfs(0, q); cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 163 ms | 272 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 796 ms | 268 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1577 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1594 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1587 ms | 2624 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1594 ms | 8120 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1592 ms | 6500 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1570 ms | 5060 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1559 ms | 8124 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1579 ms | 8300 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |