Submission #19722837


Source Code Expand

Copy
#include <map>
#include <cmath>
#include <ctime>
#include <queue>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define Int register int
#define Swap(a, b) a ^= b ^= a ^= b
#define Abs(x) ((x) < 0 ? -(x) : (x))
#define Max(x, y) ((x) < (y) ? (y) : (x))
#define Min(x, y) ((x) < (y) ? (x) : (y))
#define Isdigit(ch) (ch >= '0' and ch <= '9')

typedef pair <int, int> T;
const int MAXN = 1e6 + 10, INF = 2e9;

inline LL Read () {
	LL f = 0, x = 0;
	char ch = getchar ();

	while (!isdigit (ch) ) {
		f |= (ch == '-'), ch = getchar ();
	}

	while (isdigit (ch) ) {
		x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar ();
	}

	return f ? -x : x;
}

inline void Write (const LL &x) {
	if (x < 0 ) {
		putchar ('-'), Write (-x);
		return ;
	}

	if (x > 9 ) {
		Write (x / 10);
	}

	putchar ((x % 10) ^ 48);
	return ;
}

inline char Check (char c1, char c2) {
	if (c1 == c2 or (c1 == 'R' and c2 == 'S') or (c1 == 'S' and c2 == 'P') or (c1 == 'P' and c2 == 'R') ) {
		return c1;
	}
	
	return c2;
}

int n, k;
char DP[MAXN], Str[MAXN];

signed main () {
	Int i;
	
	cin >> n >> k >> DP;
	
	while (k -- ) {
		for (i = 0; i ^ n * 2; ++ i ) {
			Str[i] = DP[i % n];
		}
		
		for (i = 0; i ^ n; ++ i ) {
			DP[i] = Check (Str[i << 1], Str[i << 1 | 1]);
		}
	}
	
	putchar (DP[0]);
	return 0;
}

Submission Info

Submission Time
Task C - Large RPS Tournament
User C20210308
Language C++ (GCC 9.2.1)
Score 500
Code Size 1474 Byte
Status AC
Exec Time 7 ms
Memory 3612 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:66:6: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   66 |  Int i;
      |      ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 26
Set Name Test Cases
Sample sample.txt, sample_2.txt, sample_3.txt
All P.txt, R.txt, S.txt, max.txt, max_10.txt, max_2.txt, max_3.txt, max_4.txt, max_5.txt, max_6.txt, max_7.txt, max_8.txt, max_9.txt, random.txt, random_10.txt, random_2.txt, random_3.txt, random_4.txt, random_5.txt, random_6.txt, random_7.txt, random_8.txt, random_9.txt, sample.txt, sample_2.txt, sample_3.txt
Case Name Status Exec Time Memory
P.txt AC 4 ms 3420 KB
R.txt AC 2 ms 3612 KB
S.txt AC 3 ms 3396 KB
max.txt AC 2 ms 3516 KB
max_10.txt AC 2 ms 3420 KB
max_2.txt AC 2 ms 3512 KB
max_3.txt AC 5 ms 3416 KB
max_4.txt AC 2 ms 3520 KB
max_5.txt AC 2 ms 3528 KB
max_6.txt AC 2 ms 3608 KB
max_7.txt AC 2 ms 3512 KB
max_8.txt AC 7 ms 3400 KB
max_9.txt AC 2 ms 3564 KB
random.txt AC 2 ms 3556 KB
random_10.txt AC 2 ms 3396 KB
random_2.txt AC 5 ms 3552 KB
random_3.txt AC 2 ms 3604 KB
random_4.txt AC 2 ms 3516 KB
random_5.txt AC 5 ms 3420 KB
random_6.txt AC 2 ms 3492 KB
random_7.txt AC 2 ms 3568 KB
random_8.txt AC 2 ms 3416 KB
random_9.txt AC 2 ms 3548 KB
sample.txt AC 2 ms 3492 KB
sample_2.txt AC 3 ms 3552 KB
sample_3.txt AC 2 ms 3552 KB