Submission #1499168
Source Code Expand
#include <cstdio> #include <cstring> #include <vector> #include <algorithm> #include <array> #include <set> #include <map> #include <queue> #include <tuple> #include <unordered_set> #include <unordered_map> #include <functional> #include <cassert> #define repeat(i,n) for (int i = 0; (i) < int(n); ++(i)) #define repeat_from(i,m,n) for (int i = (m); (i) < int(n); ++(i)) #define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i)) #define repeat_from_reverse(i,m,n) for (int i = (n)-1; (i) >= int(m); --(i)) #define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) #define debug(x) #x << " = " << (x) << " " using ll = long long; using namespace std; constexpr size_t max_n = 200000; bool a[max_n+1]; int main() { int n, k; scanf("%d%d", &n, &k); repeat (i,n) { char c; scanf(" %c", &c); a[i] = (c == 'A'); } int m = n; a[m+1] = false; while (k --) { if (a[0]) { a[0] = false; } else { repeat (i,m) a[i] = not a[i+1]; } while (2 <= m and not a[m-2] and a[m-1]) m -= 2; if (m == 0) break; if (m == 1) k %= 2; } repeat (i,n) printf("%c", a[i] ? 'A' : 'B'); printf("\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Half Reflector |
User | kimiyuki |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1288 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 512 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:25:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] int n, k; scanf("%d%d", &n, &k); ^ ./Main.cpp:26:44: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] repeat (i,n) { char c; scanf(" %c", &c); a[i] = (c == 'A'); } ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 900 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in2.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in3.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in4.txt, in40.txt, in41.txt, in42.txt, in5.txt, in543.txt, in557.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 1 ms | 128 KB |
in10.txt | TLE | 2103 ms | 384 KB |
in11.txt | TLE | 2103 ms | 384 KB |
in12.txt | TLE | 2103 ms | 384 KB |
in13.txt | TLE | 2103 ms | 384 KB |
in14.txt | TLE | 2103 ms | 384 KB |
in15.txt | TLE | 2103 ms | 384 KB |
in16.txt | TLE | 2103 ms | 384 KB |
in17.txt | TLE | 2103 ms | 384 KB |
in18.txt | TLE | 2103 ms | 384 KB |
in19.txt | TLE | 2103 ms | 384 KB |
in2.txt | AC | 518 ms | 384 KB |
in20.txt | TLE | 2103 ms | 384 KB |
in21.txt | TLE | 2103 ms | 384 KB |
in22.txt | TLE | 2103 ms | 384 KB |
in23.txt | TLE | 2103 ms | 384 KB |
in24.txt | TLE | 2103 ms | 384 KB |
in25.txt | TLE | 2103 ms | 384 KB |
in26.txt | TLE | 2103 ms | 384 KB |
in27.txt | TLE | 2103 ms | 384 KB |
in28.txt | TLE | 2103 ms | 384 KB |
in29.txt | TLE | 2103 ms | 384 KB |
in3.txt | TLE | 2103 ms | 384 KB |
in30.txt | TLE | 2103 ms | 384 KB |
in31.txt | TLE | 2103 ms | 384 KB |
in32.txt | TLE | 2103 ms | 384 KB |
in33.txt | TLE | 2103 ms | 384 KB |
in34.txt | TLE | 2103 ms | 384 KB |
in35.txt | TLE | 2103 ms | 384 KB |
in36.txt | TLE | 2103 ms | 384 KB |
in37.txt | TLE | 2103 ms | 384 KB |
in38.txt | TLE | 2103 ms | 384 KB |
in39.txt | TLE | 2103 ms | 384 KB |
in4.txt | TLE | 2103 ms | 384 KB |
in40.txt | TLE | 2103 ms | 384 KB |
in41.txt | TLE | 2103 ms | 384 KB |
in42.txt | TLE | 2103 ms | 384 KB |
in5.txt | TLE | 2103 ms | 384 KB |
in543.txt | AC | 105 ms | 512 KB |
in557.txt | AC | 105 ms | 512 KB |
in6.txt | AC | 1 ms | 128 KB |
in7.txt | TLE | 2103 ms | 384 KB |
in8.txt | TLE | 2103 ms | 384 KB |
in9.txt | TLE | 2103 ms | 384 KB |
sample1.txt | AC | 1 ms | 128 KB |
sample2.txt | AC | 1 ms | 128 KB |
sample3.txt | AC | 1 ms | 128 KB |