Submission #1688882


Source Code Expand

#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 888888
int n,k; char s[SZ];
int ps[SZ],*h=ps,*t;
int main()
{
	scanf("%d%d%s",&n,&k,s); t=h+n-1;
	for(int i=0;i<n;++i) *(h+i)=(s[i]-'A')^(i&1);
	if(k>=n+n) k=n+n+(k-n-n)%2;
	for(int i=1;i<=k;++i)
	{
		if(*h==0) *h^=1;
		else *(++t)=(n-1)&1, ++h;
	}
	for(int i=0;i<n;++i)
		putchar((*(h+i)^(i&1))+'A');
}

Submission Info

Submission Time
Task D - Half Reflector
User fjzzq2002
Language C++14 (GCC 5.4.1)
Score 900
Code Size 1369 Byte
Status AC
Exec Time 6 ms
Memory 4480 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:37:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%s",&n,&k,s); t=h+n-1;
                         ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 900 / 900
Status
AC × 3
AC × 50
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 2 ms 2304 KB
in10.txt AC 5 ms 4096 KB
in11.txt AC 6 ms 4096 KB
in12.txt AC 5 ms 4096 KB
in13.txt AC 5 ms 4096 KB
in14.txt AC 6 ms 4096 KB
in15.txt AC 5 ms 4096 KB
in16.txt AC 5 ms 4096 KB
in17.txt AC 5 ms 3840 KB
in18.txt AC 5 ms 4096 KB
in19.txt AC 5 ms 4096 KB
in2.txt AC 3 ms 2816 KB
in20.txt AC 6 ms 3840 KB
in21.txt AC 5 ms 4096 KB
in22.txt AC 6 ms 4480 KB
in23.txt AC 6 ms 4480 KB
in24.txt AC 6 ms 4480 KB
in25.txt AC 6 ms 4224 KB
in26.txt AC 6 ms 4224 KB
in27.txt AC 6 ms 4224 KB
in28.txt AC 5 ms 3584 KB
in29.txt AC 5 ms 3584 KB
in3.txt AC 5 ms 3840 KB
in30.txt AC 5 ms 3584 KB
in31.txt AC 5 ms 3712 KB
in32.txt AC 5 ms 3712 KB
in33.txt AC 5 ms 3840 KB
in34.txt AC 6 ms 3840 KB
in35.txt AC 6 ms 3968 KB
in36.txt AC 6 ms 4096 KB
in37.txt AC 6 ms 4224 KB
in38.txt AC 6 ms 4480 KB
in39.txt AC 5 ms 3584 KB
in4.txt AC 6 ms 4480 KB
in40.txt AC 5 ms 3584 KB
in41.txt AC 5 ms 3584 KB
in42.txt AC 5 ms 3584 KB
in5.txt AC 6 ms 4480 KB
in543.txt AC 4 ms 3328 KB
in557.txt AC 4 ms 3328 KB
in6.txt AC 2 ms 2304 KB
in7.txt AC 5 ms 3840 KB
in8.txt AC 6 ms 4480 KB
in9.txt AC 5 ms 3712 KB
sample1.txt AC 2 ms 2304 KB
sample2.txt AC 2 ms 2304 KB
sample3.txt AC 2 ms 2304 KB