Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
48183 小号 【AB-1】比赛 C++ 通过 100 0 MS 256 KB 1171 2022-04-10 15:20:10

Tests(10/10):


#include <bits/stdc++.h> using namespace std; const int N = 105, T = 52; int a[N + 3 * T], b[N + 3 * T], c[N + 3 * T], d[N + 3 * T], n, t; inline void print(int x, int y) { if (x == 1) printf("G"); else { printf("R"); if (y > 1) printf("(%d)", y); } } void solve() { cin >> n >> t; char x; for (int i = 1; i <= n; i++) { cin >> x; a[i] = (x == 'R' ? 3 : 1); b[i] = 1; } for (int i = 1; i <= t; i++) { for (int j = 1; j <= n + 3 * t; j++) { if (a[j] == 1) { c[j + a[j]] = 1; d[j + a[j]] = 1; } } for (int j = 1; j <= n + 3 * t; j++) { if (a[j] == 3) { int k = j + a[j]; while (c[k] == 1) k--; c[k] = 3; d[k] += b[j]; } } for (int j = 1; j <= n + 3 * t; j++) { if (c[j] && d[j]) { print(c[j], d[j]); } a[j] = c[j]; c[j] = 0; b[j] = d[j]; d[j] = 0; } printf("\n"); } } int main() { //freopen("race.in", "r", stdin); //freopen("race.out", "w", stdout) solve(); return 0; }


测评信息: