結果
問題 |
No.1946 ロッカーの問題
|
ユーザー |
![]() |
提出日時 | 2022-05-20 22:18:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 571 bytes |
コンパイル時間 | 1,407 ms |
コンパイル使用メモリ | 167,692 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-20 08:30:21 |
合計ジャッジ時間 | 2,355 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 14 |
ソースコード
/** * @FileName a.cpp * @Author kanpurin * @Created 2022.05.20 22:18:18 **/ #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 = 1; i <= n; i++) { if (b[i] == 0) { ans++; } else { for (int j = i; j <= n; j+=i) { b[j] = 1-b[j]; } } } cout << ans << endl; return 0; }