QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#222310#7617. Spectacleucup-team1600#WA 0ms3580kbC++202.9kb2023-10-21 16:41:012023-10-21 16:41:03

Judging History

This is the latest submission verdict.

  • [2023-10-21 16:41:03]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3580kb
  • [2023-10-21 16:41:01]
  • Submitted

answer

//#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4")
#ifdef LOCAL
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstdint>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <bitset>
#include <map>
#include <queue>
#include <ctime>
#include <stack>
#include <set>
#include <list>
#include <random>
#include <deque>
#include <functional>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <complex>
#include <numeric>
#include <cassert>
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <thread>
#else
#include <bits/stdc++.h>
#endif

#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define fi first
#define se second

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

template<typename T>
inline bool umin(T &a, T b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
inline bool umax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#ifdef LOCAL
#define D for (bool _FLAG = true; _FLAG; _FLAG = false)
#define LOG(...) print(#__VA_ARGS__" ::", __VA_ARGS__) << endl
template <class ...Ts> auto &print(Ts ...ts) { return ((cerr << ts << " "), ...); }
#else
#define D while (false)
#define LOG(...)
#endif // LOCAL

const int max_n = 1e6, inf = 1000111222;

int dp[max_n] = {};
bool c[max_n] = {};

inline int calc (int n) {
    if (n == 0) {
        return  0;
    }
    if (c[n]) {
        return dp[n];
    }
    c[n] = true;
    int x = 0, y = n;
    while (y) {
        x += y % 10;
        y /= 10;
    }
    set <int> now;
    for (int val = 1; val <= x; val++) {
        now.insert(calc(n - val));
    }
    while (now.count(dp[n])) {
        ++dp[n];
    }
    return dp[n];
}

inline int sum (int x) {
    int ans = 0;
    while (x) {
        ans += x % 10;
        x /= 10;
    }
    return ans;
}


int main() {
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
//        LOG(i, calc(i));
        if (!calc(i)) {
//            LOG(i);
        }
        if (i % 10 == 0 && calc(i)) {
//            LOG("not ", i, calc(i));
        }
        bool res = bool(!calc(i));
        bool my = i % 10 == 0 && (sum(i) < 10 || sum(i) % 2 == 1);
        if (res != my) {
            LOG(i, res, my);
        }
        else if (res) {
            LOG(i);
        }
//        assert(res == my);
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3580kb

input:

6
100 13 20 14 10 105

output:


result:

wrong answer 1st lines differ - expected: '1 5 6', found: ''