提出 #38453588


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

int t;
long long n, k;;
char x[200005];

int main() {
	scanf("%d", &t);
	for (int tt = 1; tt <= t; tt++) {
		scanf("%lld%lld%s", &n, &k, x);
		bool ok = 1;
		for (int i = 0; i < min(n * 2, n + k); i++) {
			char ta = i < n ? x[i] : x[n - 1 - (i - n)];
			int tmp = (n + k - 1 - i) % (n * 2);
			char tb = tmp < n ? x[tmp] : x[n - 1 - (tmp - n)];
			if (ta != tb) {
				ok = 0;
				break;
			}
		}
		puts(ok ? "Yes" : "No");
	}
}

提出情報

提出日時
問題 A - ST and TS Palindrome
ユーザ nhho
言語 C++ (GCC 9.2.1)
得点 400
コード長 502 Byte
結果 AC
実行時間 11 ms
メモリ 3780 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   10 |  scanf("%d", &t);
      |  ~~~~~^~~~~~~~~~
./Main.cpp:12:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   12 |   scanf("%lld%lld%s", &n, &k, x);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 2
AC × 19
セット名 テストケース
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_rand_01.txt, 01_rand_02.txt, 01_rand_03.txt, 01_rand_04.txt, 01_rand_05.txt, 01_rand_06.txt, 01_rand_07.txt, 01_rand_08.txt, 02_max_rand_01.txt, 02_max_rand_02.txt, 02_max_rand_03.txt, 02_max_rand_04.txt, 03_bit_all_01.txt, 03_bit_all_02.txt, 03_bit_all_03.txt, 03_bit_all_04.txt, 03_bit_all_05.txt
ケース名 結果 実行時間 メモリ
00_sample_01.txt AC 6 ms 3460 KiB
00_sample_02.txt AC 2 ms 3540 KiB
01_rand_01.txt AC 7 ms 3588 KiB
01_rand_02.txt AC 3 ms 3576 KiB
01_rand_03.txt AC 8 ms 3540 KiB
01_rand_04.txt AC 9 ms 3456 KiB
01_rand_05.txt AC 6 ms 3432 KiB
01_rand_06.txt AC 7 ms 3588 KiB
01_rand_07.txt AC 11 ms 3624 KiB
01_rand_08.txt AC 4 ms 3624 KiB
02_max_rand_01.txt AC 11 ms 3748 KiB
02_max_rand_02.txt AC 3 ms 3776 KiB
02_max_rand_03.txt AC 11 ms 3780 KiB
02_max_rand_04.txt AC 3 ms 3780 KiB
03_bit_all_01.txt AC 2 ms 3608 KiB
03_bit_all_02.txt AC 2 ms 3588 KiB
03_bit_all_03.txt AC 2 ms 3588 KiB
03_bit_all_04.txt AC 5 ms 3536 KiB
03_bit_all_05.txt AC 8 ms 3568 KiB