結果

問題 No.1746 Sqrt Integer Segments
ユーザー 👑 kmjpkmjp
提出日時 2021-11-18 00:40:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 363 ms / 2,000 ms
コード長 1,159 bytes
コンパイル時間 2,190 ms
コンパイル使用メモリ 209,432 KB
実行使用メモリ 33,272 KB
最終ジャッジ日時 2023-10-11 10:36:32
合計ジャッジ時間 9,016 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
20,724 KB
testcase_01 AC 28 ms
20,740 KB
testcase_02 AC 242 ms
29,968 KB
testcase_03 AC 140 ms
25,700 KB
testcase_04 AC 183 ms
27,484 KB
testcase_05 AC 347 ms
33,104 KB
testcase_06 AC 113 ms
24,668 KB
testcase_07 AC 54 ms
22,044 KB
testcase_08 AC 237 ms
29,504 KB
testcase_09 AC 351 ms
33,104 KB
testcase_10 AC 108 ms
24,636 KB
testcase_11 AC 319 ms
31,912 KB
testcase_12 AC 356 ms
33,216 KB
testcase_13 AC 353 ms
33,272 KB
testcase_14 AC 357 ms
33,248 KB
testcase_15 AC 363 ms
33,228 KB
testcase_16 AC 357 ms
33,212 KB
testcase_17 AC 215 ms
28,352 KB
testcase_18 AC 39 ms
20,732 KB
testcase_19 AC 38 ms
20,728 KB
testcase_20 AC 39 ms
20,736 KB
testcase_21 AC 92 ms
20,752 KB
testcase_22 AC 91 ms
20,760 KB
testcase_23 AC 60 ms
20,748 KB
testcase_24 AC 158 ms
20,752 KB
testcase_25 AC 158 ms
20,836 KB
testcase_26 AC 158 ms
20,752 KB
testcase_27 AC 84 ms
20,972 KB
testcase_28 AC 84 ms
20,724 KB
testcase_29 AC 83 ms
20,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int N;
set<int> A[202020];

ll H[1010101];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	FOR(i,1010000) {
		H[i]=(1LL*rand()<<32)|rand();
	}
	ll cur=0;
	map<ll,int> M;
	ll ret=0;
	M[0]=1;
	cin>>N;
	FOR(i,N) {
		cin>>x;
		for(j=2;j*j<=x;j++) while(x%j==0) {
			x/=j;
			cur^=H[j];
		}
		if(x>1) cur^=H[x];
		ret+=M[cur];
		M[cur]++;
	}
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0