Submission #65347892
Source Code Expand
Copy
#include <stdio.h>#include <limits.h>#define NUM (1 << CHAR_BIT)int N;char S[114514];int set[NUM], target[NUM];void chousa(int list[], const char* str) {while (*str != '\0') {list[(unsigned char)*str]++;str++;}}int main(void) {int i;int ans = 0;if (scanf("%d", &N) != 1) return 1;
#include <stdio.h>
#include <limits.h>
#define NUM (1 << CHAR_BIT)
int N;
char S[114514];
int set[NUM], target[NUM];
void chousa(int list[], const char* str) {
while (*str != '\0') {
list[(unsigned char)*str]++;
str++;
}
}
int main(void) {
int i;
int ans = 0;
if (scanf("%d", &N) != 1) return 1;
if (scanf("%114513s", S) != 1) return 1;
chousa(set, "PAKENCAMP");
chousa(target, S);
for (i = 0; i < NUM; i++) {
if (target[i] > 0) {
int cur;
if (set[i] <= 0) {
puts("-1");
return 0;
}
cur = (target[i] + set[i] - 1) / set[i];
if (ans < cur) ans = cur;
}
}
printf("%d\n", ans);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Pakencamp |
| User | mikecat |
| Language | C (gcc 12.2.0) |
| Score | 100 |
| Code Size | 673 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 1804 KB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 1648 KB |
| 00_sample_01.txt | AC | 1 ms | 1628 KB |
| 00_sample_02.txt | AC | 1 ms | 1652 KB |
| 01_random_00.txt | AC | 1 ms | 1704 KB |
| 01_random_01.txt | AC | 1 ms | 1680 KB |
| 01_random_02.txt | AC | 0 ms | 1612 KB |
| 01_random_03.txt | AC | 1 ms | 1628 KB |
| 01_random_04.txt | AC | 1 ms | 1660 KB |
| 01_random_05.txt | AC | 1 ms | 1644 KB |
| 01_random_06.txt | AC | 1 ms | 1636 KB |
| 01_random_07.txt | AC | 1 ms | 1804 KB |
| 01_random_08.txt | AC | 1 ms | 1764 KB |
| 01_random_09.txt | AC | 1 ms | 1580 KB |
| 02_handmade_00.txt | AC | 1 ms | 1756 KB |
| 02_handmade_01.txt | AC | 1 ms | 1700 KB |
| 02_handmade_02.txt | AC | 1 ms | 1744 KB |
| 02_handmade_03.txt | AC | 0 ms | 1704 KB |
| 02_handmade_04.txt | AC | 1 ms | 1604 KB |