QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#677733#9531. Weird Ceilingucup-team5243#AC ✓92ms3752kbC++2313.3kb2024-10-26 13:20:312024-10-26 13:20:39

Judging History

你现在查看的是最新测评结果

  • [2024-10-26 13:20:39]
  • 评测
  • 测评结果:AC
  • 用时:92ms
  • 内存:3752kb
  • [2024-10-26 13:20:31]
  • 提交

answer

//line 1 "answer.cpp"
#if !__INCLUDE_LEVEL__
#include __FILE__
int solve() {
    ll n; input(n);
    auto d = divisor(n, true);
    ll mn = 1;
    ll ans = 0;
    rep(i, sz(d) - 1) {
        ans += (d[i+1] - d[i]) * (n / d[i]);
    }
    ans++;
    print(ans);
    return 0;
}
int main() {
    ll t; input(t);
    rep(i, t) solve();
}
#else
//line 2 "/home/seekworser/.cpp_lib/competitive_library/competitive/std/std.hpp"
#include <bits/stdc++.h>
#ifndef LOCAL_TEST
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif // LOCAL_TEST
using namespace std;
// 型名の短縮
using ll = long long;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using vi = vector<int>;  using vvi = vector<vi>; using vvvi = vector<vvi>;
using vl = vector<ll>;  using vvl = vector<vl>; using vvvl = vector<vvl>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vc = vector<char>; using vvc = vector<vc>; using vvvc = vector<vvc>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using vs = vector<string>; using vvs = vector<vector<string>>; using vvvs = vector<vector<vector<string>>>;
template<typename T> vector<vector<T>> vv(int h, int w, T val = T()) { return vector(h, vector<T>(w, val)); }
template<typename T> vector<vector<vector<T>>> vvv(int h1, int h2, int h3, T val = T()) { return vector(h1, vector(h2, vector<T>(h3, val))); }
template<typename T> vector<vector<vector<vector<T>>>> vvvv(int h1, int h2, int h3, int h4, T val = T()) { return vector(h1, vector(h2, vector(h3, vector<T>(h4, val)))); }
template <class T> using priority_queue_min = priority_queue<T, vector<T>, greater<T>>;
// 定数の定義
constexpr double PI = 3.14159265358979323;
constexpr int INF = 100100111; constexpr ll INFL = 3300300300300300491LL;
float EPS = 1e-8; double EPSL = 1e-16;
template<typename T> bool eq(const T x, const T y) { return x == y; }
template<> bool eq<double>(const double x, const double y) { return abs(x - y) < EPSL; }
template<> bool eq<float>(const float x, const float y) { return abs(x - y) < EPS; }
template<typename T> bool neq(const T x, const T y) { return !(eq<T>(x, y)); }
template<typename T> bool ge(const T x, const T y) { return (eq<T>(x, y) || (x > y)); }
template<typename T> bool le(const T x, const T y) { return (eq<T>(x, y) || (x < y)); }
template<typename T> bool gt(const T x, const T y) { return !(le<T>(x, y)); }
template<typename T> bool lt(const T x, const T y) { return !(ge<T>(x, y)); }
constexpr int MODINT998244353 = 998244353;
constexpr int MODINT1000000007 = 1000000007;
// 入出力高速化
struct Nyan { Nyan() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(18); } } nyan;
// 汎用マクロの定義
#define all(a) (a).begin(), (a).end()
#define sz(x) ((ll)(x).size())
#define rep1(n) for(ll dummy_iter = 0LL; dummy_iter < n; ++dummy_iter) // 0 から n-1 まで昇順
#define rep2(i, n) for(ll i = 0LL, i##_counter = 0LL; i##_counter < ll(n); ++(i##_counter), (i) = i##_counter) // 0 から n-1 まで昇順
#define rep3(i, s, t) for(ll i = ll(s), i##_counter = ll(s); i##_counter < ll(t); ++(i##_counter), (i) = (i##_counter)) // s から t まで昇順
#define rep4(i, s, t, step) for(ll i##_counter = step > 0 ? ll(s) : -ll(s), i##_end = step > 0 ? ll(t) : -ll(t), i##_step = abs(step), i = ll(s); i##_counter < i##_end; i##_counter += i##_step, i = step > 0 ? i##_counter : -i##_counter) // s から t まで stepずつ
#define overload4(a, b, c, d, e, ...) e
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define repe(a, v) for(auto& a : (v)) // v の全要素(変更可能)
#define smod(n, m) ((((n) % (m)) + (m)) % (m)) // 非負mod
#define sdiv(n, m) (((n) - smod(n, m)) / (m)) // 非負div
#define uniq(a) {sort(all(a)); (a).erase(unique(all(a)), (a).end());} // 重複除去
int Yes(bool b=true) { cout << (b ? "Yes\n" : "No\n"); return 0; };
int YES(bool b=true) { cout << (b ? "YES\n" : "NO\n"); return 0; };
int No(bool b=true) {return Yes(!b);};
int NO(bool b=true) {return YES(!b);};
template<typename T, size_t N> T max(array<T, N>& a) { return *max_element(all(a)); };
template<typename T, size_t N> T min(array<T, N>& a) { return *min_element(all(a)); };
template<typename T> T max(vector<T>& a) { return *max_element(all(a)); };
template<typename T> T min(vector<T>& a) { return *min_element(all(a)); };
template<typename T> vector<T> accum(const vector<T>& a) { vector<T> rev(sz(a)+1, 0); rep(i, sz(a)) rev[i+1] = rev[i] + a[i]; return rev; };
template<typename T> vector<T> vec_slice(const vector<T>& a, int l, int r) { vector<T> rev; rep(i, l, r) rev.push_back(a[i]); return rev; };
template<typename T> T sum(vector<T>& a, T zero = T(0)) { T rev = zero; rep(i, sz(a)) rev += a[i]; return rev; };
template<typename T> bool in_range(const T& val, const T& s, const T& t) { return s <= val && val < t; };

template <class T> inline vector<T>& operator--(vector<T>& v) { repe(x, v) --x; return v; }
template <class T> inline vector<T>& operator++(vector<T>& v) { repe(x, v) ++x; return v; }

// modでのpow
ll powm(ll a, ll n, ll mod=INFL) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * a) % mod;
        if (n > 1) a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}
// 整数Sqrt
ll sqrtll(ll x) {
    assert(x >= 0);
    ll rev = sqrt(x);
    while(rev * rev > x) --rev;
    while((rev+1) * (rev+1)<=x) ++rev;
    return rev;
}
template <class T> inline bool chmax(T& M, const T& x) { if (M < x) { M = x; return true; } return false; } // 最大値を更新(更新されたら true を返す)
template <class T> inline bool chmin(T& m, const T& x) { if (m > x) { m = x; return true; } return false; } // 最小値を更新(更新されたら true を返す)
int digit(ll x, int d=10) { int rev=0; while (x > 0) { rev++; x /= d;}; return rev; } // xのd進数桁数
/**
 * @brief std.hpp
 * @docs docs/std/std.md
 */
//line 3 "/home/seekworser/.cpp_lib/competitive_library/competitive/math/prime.hpp"
template <class T> bool is_prime(T n) {
    if (n == 1) return false;
    for (T i=2; i <= (T)std::sqrt(n); i++) {
        if (n % i == 0) return false;
    }
    return true;
};
//return all devisor
template <class T> vector<T> divisor(T n, bool sorted=true) {
    vector<T> ans(0);
    for (T i = 1; i <= (T)std::sqrt(n); i++) {
        if (n % i == 0) {
            ans.push_back(i);
            if (i * i != n) ans.push_back(n / i);
        }
    }
    if (sorted) sort(ans.begin(), ans.end());
    return ans;
};
template <class T> vector<T> prime_factor(T n) {
    vector<T> ans(0);
    for (T i = 2; i <= (T)std::sqrt(n); i++) {
        while (n % i == 0) {
            ans.push_back(i);
            n /= i;
        }
    }
    if (n != 1) ans.push_back(n);
    return ans;
};
template <class T> map<T, T> prime_factor_c(T n) {
    map<T, T> ans;
    for (T i = 2; i <= (T)std::sqrt(n); i++) {
        while (n % i == 0) {
            ans[i] += 1;
            n /= i;
        }
    }
    if (n != 1) ans[n] += 1;
    return ans;
};
template <class T> vector<T> primes(T n) {
    vector<T> ans(0);
    if (n < 2) return ans;
    vector<bool> is_primev(n+1, true);
    is_primev.at(0) = is_primev.at(1) = false;
    for (T i = 2; i <= (T)std::sqrt(n); i++) {
        if (!is_primev.at(i)) continue;
        for (T j = i*2; j <= n; j+=i) is_primev.at(j) = false;
    }
    for (T i = 2; i <= n; i++) {
        if (is_primev.at(i)) ans.push_back(i);
    }
    return ans;
};
template <class T> vector<T> segment_seive(T s, T t) {
    vector<T> ans(0);
    if (t < 2 || s < 0 || s >= t) return ans;
    vector<bool> is_prime_small((T)std::sqrt(t)+1, true);
    vector<bool> is_prime_large(t-s, true);
    for (T i = 2; i <= (T)std::sqrt(t); i++) {
        if (!is_prime_small.at(i)) continue;
        for (T j = i*2; j*j < t; j+=i) is_prime_small.at(j) = false;
        for (T j = max(2*i, ((s+i-1)/i)*i); j < t; j+=i) is_prime_large.at(j-s) = false;
    }
    for (T i=0; i < t-s; i++) {
        if (is_prime_large.at(i) && s+i != 1) ans.push_back(s+i);
    }
    return ans;
};
/**
 * @brief prime.hpp
 * @docs docs/math/prime.md
 */
//line 3 "/home/seekworser/.cpp_lib/competitive_library/competitive/std/io.hpp"
// 演算子オーバーロード(プロトタイプ宣言)
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p);
template <class T> inline istream& operator>>(istream& is, vector<T>& v);
template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p);
template <class T> inline ostream& operator<<(ostream& os, const vector<T>& v);
template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp);
template <typename T> ostream &operator<<(ostream &os, const set<T> &st);
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st);
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &st);
template <typename T> ostream &operator<<(ostream &os, queue<T> q);
template <typename T> ostream &operator<<(ostream &os, deque<T> q);
template <typename T> ostream &operator<<(ostream &os, stack<T> st);
template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq);

// 演算子オーバーロード
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template <class T> inline istream& operator>>(istream& is, vector<T>& v) { repe(x, v) is >> x; return is; }
template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.first << " " << p.second; return os; }
template <class T> inline ostream& operator<<(ostream& os, const vector<T>& v) { rep(i, sz(v)) { os << v.at(i); if (i != sz(v) - 1) os << " "; } return os; }
template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp) { for (auto &[key, val] : mp) { os << key << ":" << val << " "; } return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; }
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; }
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &st) { ll cnt = 0; for (auto &e : st) { os << e << (++cnt != (int)st.size() ? " " : ""); } return os; }
template <typename T> ostream &operator<<(ostream &os, queue<T> q) { while (q.size()) { os << q.front() << " "; q.pop(); } return os; }
template <typename T> ostream &operator<<(ostream &os, deque<T> q) { while (q.size()) { os << q.front() << " "; q.pop_front(); } return os; }
template <typename T> ostream &operator<<(ostream &os, stack<T> st) { while (st.size()) { os << st.top() << " "; st.pop(); } return os; }
template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq) { while (pq.size()) { os << pq.top() << " "; pq.pop(); } return os; }

template <typename T> int print_sep_end(string sep, string end, const T& val) { (void)sep; cout << val << end; return 0; };
template <typename T1, typename... T2> int print_sep_end(string sep, string end, const T1 &val, const T2 &...remain) {
    cout << val << sep;
    print_sep_end(sep, end, remain...);
    return 0;
};
template <typename... T> int print(const T &...args) { print_sep_end(" ", "\n", args...); return 0; };
template <typename... T> void flush() { cout << flush; };
template <typename... T> int print_and_flush(const T &...args) { print(args...); flush(); return 0; };
#define debug(...) debug_func(0, #__VA_ARGS__, __VA_ARGS__) // debug print
template <typename T> void input(T &a) { cin >> a; };
template <typename T1, typename... T2> void input(T1&a, T2 &...b) { cin >> a; input(b...); };
#ifdef LOCAL_TEST
template <typename T> void debug_func(int i, const T name) { (void)i; (void)name; cerr << endl; }
template <typename T1, typename T2, typename... T3> void debug_func(int i, const T1 &name, const T2 &a, const T3 &...b) {
    int scope = 0;
    for ( ; (scope != 0 || name[i] != ',') && name[i] != '\0'; i++ ) {
        cerr << name[i];
        if (name[i] == '(' || name[i] == '{') scope++;
        if (name[i] == ')' || name[i] == '}') scope--;
    }
    cerr << ":" << a << " ";
    debug_func(i + 1, name, b...);
}
template <typename T1, typename T2, typename... T3> void debug_func(int i, const T1 &name, T2 &a, T3 &...b) {
    int scope = 0;
    for ( ; (scope != 0 || name[i] != ',') && name[i] != '\0'; i++ ) {
        cerr << name[i];
        if (name[i] == '(' || name[i] == '{') scope++;
        if (name[i] == ')' || name[i] == '}') scope--;
    }
    cerr << ":" << a << " ";
    debug_func(i + 1, name, b...);
}
#endif
#ifndef LOCAL_TEST
template <typename... T>
void debug_func(T &...) {}
template <typename... T>
void debug_func(const T &...) {}
#endif
/**
 * @brief io.hpp
 * @docs docs/std/io.md
 */
//line 23 "answer.cpp"
#endif

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3540kb

input:

3
5
451
114514

output:

21
10251
7075858

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

1000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101...

output:

1
3
7
9
21
16
43
25
37
36
111
41
157
64
71
65
273
73
343
86
113
144
507
101
201
196
163
134
813
137
931
161
221
324
295
169
1333
400
287
205
1641
218
1807
254
277
576
2163
241
589
301
443
326
2757
298
507
317
533
900
3423
315
3661
1024
439
385
625
386
4423
494
737
437
4971
394
5257
1444
551
590
969
...

result:

ok 1000 lines

Test #3:

score: 0
Accepted
time: 92ms
memory: 3628kb

input:

1000
999999001
999999002
999999003
999999004
999999005
999999006
999999007
999999008
999999009
999999010
999999011
999999012
999999013
999999014
999999015
999999016
999999017
999999018
999999019
999999020
999999021
999999022
999999023
999999024
999999025
999999026
999999027
999999028
999999029
99999...

output:

999998001000999001
4675492974858
22093771399719
1039531946480
546491469021
75399989182
37324430219
225494920523
373593911121
479776346214
428075242211
122888183240
72251882365
33004215752
388297141779
54803541045
999998033000967273
1117647749430
2997883122147
28001063474
320813823861
206612366114726...

result:

ok 1000 lines

Test #4:

score: 0
Accepted
time: 1ms
memory: 3604kb

input:

1000
1426
8761
6399
8757
5169
7007
7204
6760
3255
8576
3090
1856
6850
5184
2915
5058
4237
4014
1867
3184
2176
4504
6628
8473
3126
7829
4842
2647
5654
9945
5344
2103
6747
3124
1506
6037
8820
2147
9017
3237
8852
3262
8746
4651
9755
6560
4143
7356
5491
6267
2956
5675
3588
5857
8003
4269
3016
8164
6913
...

output:

34481
76746361
101599
132329
2984237
142731
3265214
76077
39343
111525
35536
19757
94120
53089
52687
114368
198025
77828
3483823
61890
23713
339490
2765534
654025
283946
61285413
106256
7003963
133898
130281
75986
497711
122139
37844
69026
36439333
93043
87915
1269493
51129
4923926
80386
19131876
21...

result:

ok 1000 lines

Test #5:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

1000
96118
54869
50981
50147
91229
25850
96698
60642
84478
82418
66471
19974
29360
84515
89159
91879
15248
88581
22105
55807
94766
47749
56366
45854
78286
48453
78957
13623
66217
31578
79056
11585
56041
32429
17652
12870
35072
86731
88829
37767
39474
62357
39663
47414
96134
12753
62358
71610
61177
4...

output:

2304331
3010552293
53602881
2514671463
8322639213
373672
48480234
1867550
1784217600
1435037
491132063
11162138
454714
286303015
2957807
25703647
1014946
872109473
19699977
3114365443
2356580
14589157
794337856
4728638
10162126
1515069
1650457
297795
11135973
497770
1049881
292605
3140537641
1051607...

result:

ok 1000 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

1000
511055
954624
323224
436172
101462
148836
436478
592916
344876
280490
695050
422877
437842
854283
161072
923681
833452
995807
463367
478939
779845
311429
967338
205899
493864
398751
601817
866550
553448
183443
887925
599044
978201
552171
561895
859904
929524
729462
136217
683708
949783
507333
8...

output:

21083991
15367425
17288812
8490789
10216806
3270492
975497154
21973615190
6866746
19269664
200883352
9585213
70122662
100155511
102471994
46971481
50512556
311428839
570968779
391706527
23341213
18818905
19572693
4711106387
82854506
41504779
1271887129
14704901
103366298
8673199
152296897
35618964
2...

result:

ok 1000 lines

Test #7:

score: 0
Accepted
time: 7ms
memory: 3536kb

input:

1000
1804536
4211517
9800689
2588266
2822907
2224004
1124395
3723675
9549295
4633411
7897396
8618522
7283975
5872136
6231486
7714888
6991641
8534951
3392355
3815116
8794462
2247351
8020190
7317901
4597237
9810579
6298128
9742586
6491680
4380635
5177276
4955778
9772677
7555632
7185866
1635740
4186286...

output:

32381021
510710481
1149020421
2299688945
120557115
73058506
56457359
90096179
372486107
21468492861511
201545946
153572268266
84999326507
538810316970
135962872
197339289
2205520009
76305215151
203422271
868759184
17483594761
217570279
643282597502
6128235181
21134583436933
486148703
115320743
48435...

result:

ok 1000 lines

Test #8:

score: 0
Accepted
time: 22ms
memory: 3600kb

input:

1000
55465305
57098346
67831452
23824693
27523159
93304012
36627397
23023650
69831611
63929921
33024432
10885102
13588352
95661834
66365676
97190714
86076773
21453770
32264585
24063566
91881325
15845386
84185885
32822035
20536544
87894581
10991552
65603223
14485832
20112669
42652175
83388813
3890302...

output:

1233522469
30231587353
3485251508
200993174065
61256171487
544102695868046
1341566174368213
557396664
7256897799
33778361768221
648207543
7401958318
308423669
254200007209658
3360589556
61975730378
756052267777
510366691
41640363660985
1261557526
3244098109
62769080217636
5786851143705
1258948719
45...

result:

ok 1000 lines

Test #9:

score: 0
Accepted
time: 62ms
memory: 3752kb

input:

1000
915367597
170378636
313770228
902526612
145496151
799225282
489090313
639368427
246375473
965529510
818379863
170086887
211624645
105858477
871824152
641165798
917699672
840652762
179213821
772528742
876606466
644924443
694785183
462164454
633265058
458266866
379020271
665531243
266287336
36576...

output:

871956022960393
7291034186
683694527886654
32386492870
14238918027
2623954560326
296562492633
56988743615
60700873449598257
8574022008528
13668286556543775
4666778451
10045018693
56385310781
11876212984285122
12421378985324
13158952838325042
176674267405209924
33431586765721
38406969428
116532883578...

result:

ok 1000 lines

Test #10:

score: 0
Accepted
time: 61ms
memory: 3524kb

input:

1000
585368002
306372175
416009662
257921061
296636294
870174287
978777851
350263974
606394638
185068088
403887189
407868682
804385858
76886268
259240128
25474974
624426864
479700338
181087332
695036802
747196218
906596932
309327980
257146299
206966230
802007505
987169016
135879955
49370780
63200667...

output:

1610711004706
49023158527
370147227518
1479769413469
59376015616
74401504037683
958006080629400351
10397833137
134489000569
83188941708
18337125509
246095742345598
208410552920
41052506570574
41481313786
871973361
595397901886
20479528405
4500211661
24518043503
128623382928
142311967870164
104523427...

result:

ok 1000 lines

Extra Test:

score: 0
Extra Test Passed