結果
問題 |
No.1470 Mex Sum
|
ユーザー |
|
提出日時 | 2021-01-07 20:15:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 606 bytes |
コンパイル時間 | 722 ms |
コンパイル使用メモリ | 38,480 KB |
実行使用メモリ | 15,312 KB |
最終ジャッジ日時 | 2024-11-14 00:23:04 |
合計ジャッジ時間 | 122,780 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <algorithm> #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") 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++) { unsigned char t = ~(a[i] | a[j]); t = (t & (-t)) - 1; ans += __builtin_popcount(t) + 1; } } printf("%lld\n", ans); }