Submission #49165438


Source Code Expand

// LUOGU_RID: 142309631
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;

#define rep(i,l,r) for(int i(l);i<=(r);++i)
#define per(i,r,l) for(int i(r);i>=(l);--i)
#define eb emplace_back
#define File(filename) freopen(filename ".in","r",stdin),freopen(filename ".out","w",stdout)

#ifdef EXODUS
	#define Debug(...) fprintf(stderr,__VA_ARGS__)
#else
	#define Debug(...) 0
#endif

//=========================================================================================================
// Something about IO

template<typename T>
void read(T &x){
	x=0;T flg=1;
	char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')flg=-1;ch=getchar();}
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	x*=flg;
}
template<typename T,typename... Args>
void read(T &x,Args &...args){read(x),read(args...);}

//=========================================================================================================
// Define the global variables here.

bool membg=0;

constexpr int N=2e5+7,lim=2e5;
int n,a[N],cnt[N],cur[N],sg[N][2];
vector<int>d[N];

bool memed=0;

//=========================================================================================================
// Code here.

void solve(){
	for(int i=2;i<=lim;i++)
		for(int j=i;j<=lim;j+=i)
			d[j].eb(i);
	read(n);
	for(int i=1;i<=n;i++)read(a[i]),cnt[a[i]]++;
	for(int i=2;i<=lim;i++)
		for(int j=2*i;j<=lim;j+=i)
			cnt[i]+=cnt[j];
	for(int i=2;i<=lim;i++){
		bool vaild=false;
		for(auto x:d[i])cur[x]=cnt[x];
		for(int p=(int)d[i].size()-1,x;p>=0;p--){
			x=d[i][p];
			if(p!=(int)d[i].size()-1&&cur[x]!=0){
				if(!sg[x][1])sg[i][0]=true,vaild=true;
				if(!sg[x][0])sg[i][1]=true,vaild=true;
			}
			for(auto y:d[x])
				cur[y]-=cur[x];
		}
		if(!vaild)sg[i][cnt[i]&1]=true;
	}
	for(int i=1;i<=n;i++)
		puts(sg[a[i]][0]?"Aoki":"Takahashi");
	return;
}


//=========================================================================================================

int main(){
	Debug("%.3lfMB\n",fabs(&memed-&membg)/1024.0/1024.0);
	int timbg=clock();
	int T=1;
	while(T--)solve();
	int timed=clock();
	Debug("%.3lfs\n",1.0*(timed-timbg)/CLOCKS_PER_SEC);
	fflush(stdout);
	return 0;
}

Submission Info

Submission Time
Task D - Avoid Coprime Game
User EXODUS
Language C++ 20 (gcc 12.2)
Score 800
Code Size 2325 Byte
Status AC
Exec Time 132 ms
Memory 28200 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:18:28: warning: statement has no effect [-Wunused-value]
   18 |         #define Debug(...) 0
      |                            ^
Main.cpp:81:9: note: in expansion of macro ‘Debug’
   81 |         Debug("%.3lfMB\n",fabs(&memed-&membg)/1024.0/1024.0);
      |         ^~~~~
Main.cpp:18:28: warning: statement has no effect [-Wunused-value]
   18 |         #define Debug(...) 0
      |                            ^
Main.cpp:86:9: note: in expansion of macro ‘Debug’
   86 |         Debug("%.3lfs\n",1.0*(timed-timbg)/CLOCKS_PER_SEC);
      |         ^~~~~
Main.cpp:82:13: warning: unused variable ‘timbg’ [-Wunused-variable]
   82 |         int timbg=clock();
      |             ^~~~~
Main.cpp:85:13: warning: unused variable ‘timed’ [-Wunused-variable]
   85 |         int timed=clock();
      |             ^~~~~

Judge Result

Set Name Sample All After Contest
Score / Max Score 0 / 0 800 / 800 0 / 0
Status
AC × 3
AC × 43
AC × 1
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_rand1_01.txt, 01_rand1_02.txt, 01_rand1_03.txt, 01_rand1_04.txt, 01_rand1_05.txt, 01_rand1_06.txt, 01_rand1_07.txt, 01_rand1_08.txt, 01_rand1_09.txt, 01_rand1_10.txt, 02_rand2_01.txt, 02_rand2_02.txt, 02_rand2_03.txt, 02_rand2_04.txt, 02_rand2_05.txt, 02_rand2_06.txt, 02_rand2_07.txt, 02_rand2_08.txt, 02_rand2_09.txt, 02_rand2_10.txt, 03_rand3_01.txt, 03_rand3_02.txt, 03_rand3_03.txt, 03_rand3_04.txt, 03_rand3_05.txt, 03_rand3_06.txt, 03_rand3_07.txt, 03_rand3_08.txt, 03_rand3_09.txt, 03_rand3_10.txt, 03_rand3_11.txt, 03_rand3_12.txt, 03_rand3_13.txt, 03_rand3_14.txt, 03_rand3_15.txt, 04_test_01.txt, 04_test_02.txt, 04_test_03.txt, 04_test_04.txt, 04_test_05.txt
After Contest after_contest_01.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 103 ms 26900 KiB
00_sample_02.txt AC 107 ms 26800 KiB
00_sample_03.txt AC 109 ms 26936 KiB
01_rand1_01.txt AC 124 ms 28068 KiB
01_rand1_02.txt AC 118 ms 28120 KiB
01_rand1_03.txt AC 127 ms 27972 KiB
01_rand1_04.txt AC 120 ms 27700 KiB
01_rand1_05.txt AC 117 ms 27580 KiB
01_rand1_06.txt AC 120 ms 27680 KiB
01_rand1_07.txt AC 120 ms 27984 KiB
01_rand1_08.txt AC 119 ms 28196 KiB
01_rand1_09.txt AC 122 ms 28012 KiB
01_rand1_10.txt AC 117 ms 28048 KiB
02_rand2_01.txt AC 125 ms 27968 KiB
02_rand2_02.txt AC 124 ms 28068 KiB
02_rand2_03.txt AC 122 ms 27936 KiB
02_rand2_04.txt AC 128 ms 28052 KiB
02_rand2_05.txt AC 128 ms 28192 KiB
02_rand2_06.txt AC 121 ms 27944 KiB
02_rand2_07.txt AC 122 ms 28016 KiB
02_rand2_08.txt AC 123 ms 28156 KiB
02_rand2_09.txt AC 122 ms 28196 KiB
02_rand2_10.txt AC 129 ms 28064 KiB
03_rand3_01.txt AC 128 ms 28200 KiB
03_rand3_02.txt AC 124 ms 28048 KiB
03_rand3_03.txt AC 126 ms 28168 KiB
03_rand3_04.txt AC 123 ms 28064 KiB
03_rand3_05.txt AC 127 ms 28200 KiB
03_rand3_06.txt AC 128 ms 28028 KiB
03_rand3_07.txt AC 126 ms 27992 KiB
03_rand3_08.txt AC 131 ms 28064 KiB
03_rand3_09.txt AC 126 ms 28048 KiB
03_rand3_10.txt AC 126 ms 27992 KiB
03_rand3_11.txt AC 124 ms 28068 KiB
03_rand3_12.txt AC 132 ms 28192 KiB
03_rand3_13.txt AC 129 ms 28048 KiB
03_rand3_14.txt AC 131 ms 28196 KiB
03_rand3_15.txt AC 120 ms 28052 KiB
04_test_01.txt AC 105 ms 26888 KiB
04_test_02.txt AC 118 ms 28052 KiB
04_test_03.txt AC 120 ms 27972 KiB
04_test_04.txt AC 121 ms 28092 KiB
04_test_05.txt AC 119 ms 28068 KiB
after_contest_01.txt AC 105 ms 26844 KiB