Submission #345490


Source Code Expand

Copy
#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
const int VAL = 100005;


int nVal;
int val[VAL];

void read() {
    cin >> nVal;
    for (int i = 0; i < nVal; ++i)
        cin >> val[i];
}


void work() {
    set<int> isOk;
    int maxV = 0;

    for (int i = 0; i < nVal; ++i) {
        isOk.insert(val[i]);
        maxV = max(maxV, val[i]);
    }

    int ans = 0;
    
    for (set<int>::iterator it = isOk.begin(); it != isOk.end(); ++it) {
        int curV = *it;
        while (2LL * curV <= maxV) {
            curV *= 2;
            isOk.erase(curV);
        }
        ++ans;
    }

    cout << ans << endl;
}


int main() {
    read();
    work();
    return 0;
}

Submission Info

Submission Time
Task C - 高橋くんと魔法の箱
User Hachimori
Language C++ (G++ 4.6.4)
Score 100
Code Size 746 Byte
Status
Exec Time 205 ms
Memory 5856 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
Subtask1 20 / 20 subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_2.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt, subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
Subtask2 30 / 30 subtask2_0.txt, subtask2_1.txt, subtask2_2.txt, subtask2_3.txt, subtask2_4.txt, subtask2_5.txt, subtask2_6.txt, subtask2_7.txt, subtask2_8.txt, subtask2_9.txt, subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
All 50 / 50 subtask0_0.txt, subtask0_1.txt, subtask0_2.txt, subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_2.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt, subtask2_0.txt, subtask2_1.txt, subtask2_2.txt, subtask2_3.txt, subtask2_4.txt, subtask2_5.txt, subtask2_6.txt, subtask2_7.txt, subtask2_8.txt, subtask2_9.txt, subtask3_0.txt, subtask3_1.txt, subtask3_2.txt, subtask3_3.txt, subtask3_4.txt, subtask3_5.txt, subtask3_6.txt, subtask3_7.txt, subtask3_8.txt, subtask3_9.txt
Case Name Status Exec Time Memory
subtask0_0.txt 24 ms 932 KB
subtask0_1.txt 22 ms 916 KB
subtask0_2.txt 23 ms 924 KB
subtask1_0.txt 24 ms 872 KB
subtask1_1.txt 25 ms 936 KB
subtask1_10.txt 25 ms 924 KB
subtask1_11.txt 27 ms 916 KB
subtask1_12.txt 24 ms 924 KB
subtask1_13.txt 25 ms 928 KB
subtask1_14.txt 27 ms 936 KB
subtask1_15.txt 25 ms 924 KB
subtask1_16.txt 25 ms 932 KB
subtask1_17.txt 28 ms 1060 KB
subtask1_18.txt 25 ms 928 KB
subtask1_19.txt 26 ms 932 KB
subtask1_2.txt 26 ms 940 KB
subtask1_3.txt 24 ms 1056 KB
subtask1_4.txt 24 ms 1048 KB
subtask1_5.txt 24 ms 916 KB
subtask1_6.txt 26 ms 1060 KB
subtask1_7.txt 26 ms 928 KB
subtask1_8.txt 28 ms 1056 KB
subtask1_9.txt 24 ms 1056 KB
subtask2_0.txt 143 ms 5804 KB
subtask2_1.txt 158 ms 5800 KB
subtask2_2.txt 150 ms 5796 KB
subtask2_3.txt 147 ms 5792 KB
subtask2_4.txt 148 ms 5852 KB
subtask2_5.txt 147 ms 5800 KB
subtask2_6.txt 148 ms 5800 KB
subtask2_7.txt 205 ms 5856 KB
subtask2_8.txt 160 ms 5804 KB
subtask2_9.txt 197 ms 5800 KB
subtask3_0.txt 143 ms 5788 KB
subtask3_1.txt 177 ms 5792 KB
subtask3_2.txt 168 ms 5792 KB
subtask3_3.txt 167 ms 5800 KB
subtask3_4.txt 183 ms 5800 KB
subtask3_5.txt 178 ms 5788 KB
subtask3_6.txt 176 ms 5800 KB
subtask3_7.txt 184 ms 5792 KB
subtask3_8.txt 168 ms 5800 KB
subtask3_9.txt 169 ms 5792 KB