結果

問題 No.1946 ロッカーの問題
ユーザー mnmmnm
提出日時 2022-06-20 00:48:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 923 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 78,860 KB
実行使用メモリ 10,272 KB
最終ジャッジ日時 2024-04-20 09:46:37
合計ジャッジ時間 5,693 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <bitset>

#define rep(i,n) for(i=0; i<n; ++i)
#define dec_rep(i,n) for(i=n; i>=0; --i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
#define print_vec(v) for(auto it=v.begin();it!=v.end();++it)cout<<*it <<" ";cout<<endl
#define print_vec2d(v) for(int i=0;i<v.size();++i){for(int j=0;j<v[i].size();++j)cout<<v[i][j]<<" ";cout<<endl;}cout<<endl
using namespace std;
using lint = long long;

int main(void){
    lint i, j, k, cnt=0, x, y;
    lint p, n, m;
    in(n); in(m);
    vector<bool> v(n,false);
    rep(i,m){
        in(k);
        v[k-1]=true;
    }
    dec_rep(i,n-1){
        if(v[i]){
            rep(j,i+1){
                if((i+1)%(j+1)==0){
                    v[j].flip();
                }
            }
        }
        else    cnt++;
    }
    out(cnt,endl);
    return 0;
}
0