結果
問題 |
No.1470 Mex Sum
|
ユーザー |
|
提出日時 | 2021-01-07 20:25:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 533 bytes |
コンパイル時間 | 573 ms |
コンパイル使用メモリ | 45,696 KB |
最終ジャッジ日時 | 2025-01-17 10:23:22 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 TLE * 39 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d", &temp); | ~~~~~^~~~~~~~~~~~~
ソースコード
#pragma GCC target("sse4") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <stdio.h> #include <algorithm> unsigned char a[200000]; int n; using ll = long long; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { int temp; scanf("%d", &temp); a[i] = 1 << std::min(temp - 1, 2); } ll ans = 0; for (int j = 0; j < n; j++) { for (int i = 0; i < j; i++) { ans += __builtin_ffs(~(a[i] | a[j])); } } printf("%lld\n", ans); }