# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1075243 | 2024-08-25T21:28:37 Z | raduv | Treasure (info1cup19_treasure) | C++17 | 2 ms | 604 KB |
#include <bits/stdc++.h> #define DEBUG 1 using namespace std; const int MAXN = 200'000; int stiva[MAXN + 1][2]; int ns; int main() { char ch; int n, k, i; scanf("%d%d ", &n, &k); for( i = 0; i < n; i++ ){ ch = fgetc(stdin); ch -= 'a'; if(ns > 0 && stiva[ns][0] == ch){ stiva[ns][1]++; if(stiva[ns][1] == k){ stiva[ns][1] = 0; stiva[ns][0] = 0; ns--; } } else{ ns++; stiva[ns][0] = ch; stiva[ns][1] = 1; } } for( i = 1; i <= ns; i++ ){ while(stiva[i][1] > 0){ fputc(stiva[i][0] + 'a', stdout); stiva[i][1]--; } } fputc('\n', stdout); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 604 KB | Output is correct |
25 | Correct | 1 ms | 460 KB | Output is correct |
26 | Correct | 1 ms | 604 KB | Output is correct |
27 | Correct | 1 ms | 604 KB | Output is correct |
28 | Correct | 1 ms | 604 KB | Output is correct |
29 | Correct | 1 ms | 604 KB | Output is correct |
30 | Correct | 2 ms | 604 KB | Output is correct |
31 | Correct | 1 ms | 604 KB | Output is correct |
32 | Correct | 1 ms | 604 KB | Output is correct |
33 | Correct | 1 ms | 604 KB | Output is correct |
34 | Correct | 1 ms | 604 KB | Output is correct |
35 | Correct | 1 ms | 604 KB | Output is correct |