結果
| 問題 |
No.2073 Concon Substrings (Swap Version)
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2022-09-18 01:42:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 776 bytes |
| コンパイル時間 | 272 ms |
| コンパイル使用メモリ | 42,056 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-22 01:04:58 |
| 合計ジャッジ時間 | 1,677 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 17 WA * 20 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 2073.cc: No.2073 Concon Substrings (Swap Version) - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 200000;
const int MAX_N3 = MAX_N * 3;
enum { C = 2, O = 14, N = 13 };
/* typedef */
/* global variables */
char s[MAX_N3 + 4];
int cs[3][26];
/* subroutines */
/* main */
int main() {
int n;
scanf("%d%s", &n, s);
int n3 = n * 3;
for (int i = 0; i < n3; i++) cs[i % 3][s[i] - 'a']++;
int sum = 0;
for (int i = 0; i < 3; i++) {
int i1 = (i + 1) % 3, i2 = (i + 2) % 3;
sum += min(cs[i][C], min(cs[i1][O], cs[i2][N]));
}
printf("%d\n", sum);
//for (int i = 0; i < 3; i++)
//printf("%d: %d,%d,%d\n", i, cs[i][C], cs[i][O], cs[i][N]);
return 0;
}
tnakao0123