답안 #860779

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
860779 2023-10-14T09:06:17 Z Ellinor 수열 (BOI14_sequence) C++14
34 / 100
1000 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast,inline") // Ofast = O3,fast-math,allow-store-data-races,no-protect-parens
#pragma GCC optimize ("unroll-loops")

#pragma GCC target("bmi,bmi2,lzcnt,popcnt")                      // bit manipulation
#pragma GCC target("movbe")                                      // byte swap
#pragma GCC target("aes,pclmul,rdrnd")                           // encryption
#pragma GCC target("avx,avx2,f16c,fma,sse3,ssse3,sse4.1,sse4.2")

typedef long long ll;
#define rep(i, a, b) for (int i = (a); i < int(b); i++)
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define pb push_back

inline void fast() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }

ll INF = 1000000000;
ll mod = 1e9 + 7;

#define int ll
#define float double

//
int K;
vector<char> ks;

int32_t main()
{
    fast();
    cin >> K;
    ks.assign(K, -1);
    bool same = true;
    rep(i,0,K) {
        cin >> ks[i];
        if (ks[i] != ks[0]) same = false;
    }

    if (same) 
    {
        ll nat = 1, at = 1;
        while (true)
        {
            if (at - nat == K) {
                cout << nat << "\n";
                exit(0);
            }

            string sat = to_string(at);
            bool bat = false;
            rep(i,0,sat.size()) {
                if (sat[i] == ks[0]) {
                    bat = true;
                    break;
                }
            }
            if (!bat) nat = at + 1;
            at++;
        }
    }
    else
    {
        rep(n,1,10000000000) {
            bool nat = true;
            rep(at,0,K) {
                string sat = to_string(n + at);
                bool bat = false;
                rep(i,0,sat.size()) {
                    if (sat[i] == ks[at]) {
                        bat = true;
                        break;
                    }
                }
                nat = nat && bat;
                if (!nat) break;
            }
            if (nat) {
                cout << n << "\n";
                exit(0);
            }
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 600 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Execution timed out 1034 ms 344 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 14 ms 348 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 14 ms 348 KB Output is correct
6 Correct 1 ms 464 KB Output is correct
7 Correct 6 ms 348 KB Output is correct
8 Correct 17 ms 500 KB Output is correct
9 Correct 11 ms 348 KB Output is correct
10 Correct 14 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 437 ms 492 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 456 KB Output is correct
11 Execution timed out 1029 ms 600 KB Time limit exceeded
12 Halted 0 ms 0 KB -