답안 #38526

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
38526 2018-01-04T11:02:08 Z bakurits 수열 (BOI14_sequence) C++14
34 / 100
1000 ms 41468 KB
#include <iostream>
#include <stdio.h>

const int N = 1e5 + 10;
const int BIG_N = 1e7;

using namespace std;

int n;
int a[N], mask[BIG_N];


int main() {

    scanf("%d", &n);

    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);

    for (int i = 1; i < BIG_N; i++) {
        int x = i;
        while (x > 0) {
            mask[i] |= (1 << (x %10));
            x /= 10;
        }
    }


    for (int i = 1; i < BIG_N; i++) {
        bool flag = true;
        for (int j = 0; j < n; j++) {
            if (!(mask[i + j] & (1 << a[j]))) {
                flag = false;
                break;
            }
        }
        if (flag) {
            printf("%d\n", i);
            return 0;
        }
    }

}

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:15:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
sequence.cpp:18:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a[i]);
                           ^
# 결과 실행 시간 메모리 Grader output
1 Correct 236 ms 41468 KB Output is correct
2 Correct 233 ms 41468 KB Output is correct
3 Correct 226 ms 41468 KB Output is correct
4 Correct 229 ms 41468 KB Output is correct
5 Correct 193 ms 41468 KB Output is correct
6 Correct 236 ms 41468 KB Output is correct
7 Correct 203 ms 41468 KB Output is correct
8 Correct 216 ms 41468 KB Output is correct
9 Correct 199 ms 41468 KB Output is correct
10 Correct 216 ms 41468 KB Output is correct
11 Correct 206 ms 41468 KB Output is correct
12 Correct 249 ms 41468 KB Output is correct
13 Correct 193 ms 41468 KB Output is correct
14 Correct 223 ms 41468 KB Output is correct
15 Correct 213 ms 41468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 209 ms 41468 KB Output is correct
2 Correct 236 ms 41468 KB Output is correct
3 Correct 206 ms 41468 KB Output is correct
4 Correct 216 ms 41468 KB Output is correct
5 Correct 213 ms 41468 KB Output is correct
6 Correct 226 ms 41468 KB Output is correct
7 Correct 226 ms 41468 KB Output is correct
8 Correct 246 ms 41468 KB Output is correct
9 Correct 209 ms 41468 KB Output is correct
10 Correct 216 ms 41468 KB Output is correct
11 Execution timed out 1000 ms 41468 KB Execution timed out
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 189 ms 41468 KB Output is correct
2 Correct 196 ms 41468 KB Output is correct
3 Correct 763 ms 41468 KB Output is correct
4 Correct 236 ms 41468 KB Output is correct
5 Correct 816 ms 41468 KB Output is correct
6 Correct 239 ms 41468 KB Output is correct
7 Correct 423 ms 41468 KB Output is correct
8 Correct 773 ms 41468 KB Output is correct
9 Correct 563 ms 41468 KB Output is correct
10 Correct 679 ms 41468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 219 ms 41468 KB Output is correct
2 Correct 206 ms 41468 KB Output is correct
3 Correct 236 ms 41468 KB Output is correct
4 Correct 209 ms 41468 KB Output is correct
5 Incorrect 283 ms 41468 KB Output isn't correct
6 Halted 0 ms 0 KB -