結果
問題 | No.1746 Sqrt Integer Segments |
ユーザー | square1001 |
提出日時 | 2021-11-18 00:07:31 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 915 bytes |
コンパイル時間 | 916 ms |
コンパイル使用メモリ | 77,988 KB |
実行使用メモリ | 5,636 KB |
最終ジャッジ日時 | 2023-08-25 21:17:55 |
合計ジャッジ時間 | 8,619 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,384 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 33 ms
5,332 KB |
testcase_19 | AC | 32 ms
5,504 KB |
testcase_20 | AC | 33 ms
5,520 KB |
testcase_21 | AC | 94 ms
4,380 KB |
testcase_22 | AC | 92 ms
4,384 KB |
testcase_23 | AC | 47 ms
4,380 KB |
testcase_24 | AC | 188 ms
5,504 KB |
testcase_25 | AC | 188 ms
5,388 KB |
testcase_26 | AC | 187 ms
5,540 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
ソースコード
#include <vector> #include <iostream> #include <algorithm> using namespace std; uint64_t xorshift64(uint64_t h) { h ^= h << 13; h ^= h >> 7; h ^= h << 17; return h; } int main() { int N; cin >> N; vector<int> A(N); for(int i = 0; i < N; ++i) { cin >> A[i]; } vector<uint64_t> s(N + 1); for(int i = 0; i < N; ++i) { for(int j = 2; j * j <= A[i]; ++j) { while(A[i] % j == 0) { A[i] /= j; s[i + 1] ^= xorshift64(xorshift64(xorshift64(xorshift64(xorshift64(xorshift64(j)))))); } } if(A[i] != 1) { s[i + 1] ^= xorshift64(xorshift64(xorshift64(xorshift64(xorshift64(xorshift64(A[i])))))); } } for(int i = 1; i <= N; ++i) { s[i] ^= s[i - 1]; } sort(s.begin(), s.end()); long long ans = 0; int pre = 0; for(int i = 1; i <= N + 1; ++i) { if(i == N + 1 || s[i] != s[i - 1]) { ans += 1LL * (i - pre) * (i - pre - 1) / 2; pre = i; } } cout << ans << endl; return 0; }