페이지

11723번: 집합

https://www.acmicpc.net/problem/11723

$O(m)$

#include<cstdio>
int m, x, ck[21];
char s[7];
int main() {
    for (scanf("%d", &m); m--;) {
        scanf("%s", s);
        if (s[1] == 'l'for (int i = 1; i <= 20; i++) ck[i] = 1;
        else if (s[1] == 'm'for (int i = 1; i <= 20; i++) ck[i] = 0;
        else {
            scanf("%d", &x);
            if (s[1] == 'd') ck[x] = 1;
            else if (s[1] == 'e') ck[x] = 0;
            else if (s[1] == 'h') printf("%d\n", ck[x]);
            else ck[x] = !ck[x];
        }
    }
    return 0;
}

댓글 없음 :

댓글 쓰기