結果
| 問題 |
No.1946 ロッカーの問題
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-09-27 14:23:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 273 ms / 3,000 ms |
| コード長 | 578 bytes |
| コンパイル時間 | 805 ms |
| コンパイル使用メモリ | 75,024 KB |
| 最終ジャッジ日時 | 2025-02-07 17:15:47 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n,m;cin>>n>>m;
vector<int> A(m);
for(int i = 0; m > i; i++){
cin>>A[m-i-1];
}
vector<int> B(n+1);
int ans = 0;
int nw = 0;
for(int i = n; 0 < i; i--){
bool odd = false;
if(nw != m && A[nw] == i){
odd = true;
nw++;
}
if(B[i]%2 != odd){
//used
for(int j = 1; i >= j*j; j++){
if(i%j == 0){
B[j]++;
if(j*j!=i)B[i/j]++;
}
}
}else{
ans++;
}
}
cout << ans << endl;
}