# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101317 | 2019-03-18T12:29:36 Z | MohamedAhmed0 | Take-out (POI13_usu) | C++14 | 86 ms | 7024 KB |
#include <bits/stdc++.h> using namespace std ; const int MAX = 1000000 ; int arr[MAX] ; int main() { int n , k ; cin>>n>>k ; string s ; cin>>s ; int cnt = 0 ; vector<int>v ; vector< vector<int> >ans ; for(int i = 0 ; i < n ; ++i) { v.push_back(i) ; if(s[i] == 'b') arr[cnt]++ ; else if(s[i] == 'c') cnt++ ; if(cnt == 0) continue ; if(arr[cnt] + arr[cnt-1] == k) { int s = v.size()-k-1 ; vector<int>tmp ; for(int j = s ; j <= s+k ; ++j) tmp.push_back(v[j]) ; for(int j = 0 ; j < k+1 ; ++j) v.pop_back() ; ans.push_back(tmp) ; arr[cnt] = 0 ; --cnt ; arr[cnt] = 0 ; } } reverse(ans.begin() , ans.end()) ; for(int i = 0 ; i < ans.size() ; ++i) { for(int j = 0 ; j < ans[i].size() ; ++j) cout<<ans[i][j]+1<<" "; cout<<"\n"; } return 0 ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Unexpected end of file - int32 expected |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 384 KB | Unexpected end of file - int32 expected |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 512 KB | Output is correct |
2 | Incorrect | 4 ms | 384 KB | Unexpected end of file - int32 expected |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 1852 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 39 ms | 3580 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 58 ms | 4644 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 86 ms | 7024 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 55 ms | 6504 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |