結果
| 問題 | 
                            No.1946 ロッカーの問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             沙耶花
                         | 
                    
| 提出日時 | 2022-05-20 21:37:52 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 457 bytes | 
| コンパイル時間 | 4,000 ms | 
| コンパイル使用メモリ | 250,152 KB | 
| 最終ジャッジ日時 | 2025-01-29 10:16:47 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 5 WA * 14 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000
int main() {
    
	int n,m;
	cin>>n>>m;
	
	vector<int> f(n+1,0);
	rep(i,m){
		
		int a;
		cin>>a;
		f[a] = 1;
	}
	
	int ans = 0;
	for(int i=1;i<=n;i++){
		if(f[i]==0)ans++;
		else{
			for(int j=i;j<=n;j+=i)f[j] ^= 1;
		}
	}
	
	cout<<ans<<endl;
	
    return 0;
}
            
            
            
        
            
沙耶花