結果
問題 |
No.1946 ロッカーの問題
|
ユーザー |
![]() |
提出日時 | 2022-05-20 22:39:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 57 ms / 3,000 ms |
コード長 | 619 bytes |
コンパイル時間 | 1,482 ms |
コンパイル使用メモリ | 167,696 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-20 08:58:05 |
合計ジャッジ時間 | 2,369 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
/** * @FileName a.cpp * @Author kanpurin * @Created 2022.05.20 22:39:23 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n,m;cin >> n >> m; vector<int> b(n+1); for (int i = 0; i < m; i++) { int a;cin >> a; b[a] = 1; } int ans = 0; for (int i = n; i >= 1; i--) { int t = 0; for (int j = i; j <= n; j+=i) { t += b[j]; } if (t % 2 == 1) { b[i] = 1; } else { ans++; b[i] = 0; } } cout << ans << endl; return 0; }