QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#119217 | #5574. Julienne the Deck | hos_lyric | AC ✓ | 1ms | 3816kb | C++14 | 3.9kb | 2023-07-05 05:14:42 | 2023-07-05 05:14:56 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
static constexpr unsigned M = M_;
unsigned x;
constexpr ModInt() : x(0U) {}
constexpr ModInt(unsigned x_) : x(x_ % M) {}
constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
ModInt pow(long long e) const {
if (e < 0) return inv().pow(-e);
ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
}
ModInt inv() const {
unsigned a = M, b = x; int y = 0, z = 1;
for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
assert(a == 1U); return ModInt(y);
}
ModInt operator+() const { return *this; }
ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
explicit operator bool() const { return x; }
bool operator==(const ModInt &a) const { return (x == a.x); }
bool operator!=(const ModInt &a) const { return (x != a.x); }
friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////
constexpr unsigned MO = 998244353;
using Mint = ModInt<MO>;
int main() {
Int N;
for (; ~scanf("%lld", &N); ) {
Mint ans;
if (N <= 2) {
ans = 1;
} else {
ans = 2 * N;
}
printf("%u\n", ans.x);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
input:
1
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
1000000000000
output:
516560941
result:
ok 1 number(s): "516560941"
Test #3:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
3
output:
6
result:
ok 1 number(s): "6"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
4
output:
8
result:
ok 1 number(s): "8"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
2
output:
1
result:
ok 1 number(s): "1"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
5
output:
10
result:
ok 1 number(s): "10"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
6
output:
12
result:
ok 1 number(s): "12"
Test #8:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
7
output:
14
result:
ok 1 number(s): "14"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
8
output:
16
result:
ok 1 number(s): "16"
Test #10:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
9
output:
18
result:
ok 1 number(s): "18"
Test #11:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
10
output:
20
result:
ok 1 number(s): "20"
Test #12:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
11
output:
22
result:
ok 1 number(s): "22"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
12
output:
24
result:
ok 1 number(s): "24"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
13
output:
26
result:
ok 1 number(s): "26"
Test #15:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
14
output:
28
result:
ok 1 number(s): "28"
Test #16:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
15
output:
30
result:
ok 1 number(s): "30"
Test #17:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
16
output:
32
result:
ok 1 number(s): "32"
Test #18:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
17
output:
34
result:
ok 1 number(s): "34"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
18
output:
36
result:
ok 1 number(s): "36"
Test #20:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
19
output:
38
result:
ok 1 number(s): "38"
Test #21:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
20
output:
40
result:
ok 1 number(s): "40"
Test #22:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
999999999950
output:
516560841
result:
ok 1 number(s): "516560841"
Test #23:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
999999999951
output:
516560843
result:
ok 1 number(s): "516560843"
Test #24:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
999999999952
output:
516560845
result:
ok 1 number(s): "516560845"
Test #25:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
999999999953
output:
516560847
result:
ok 1 number(s): "516560847"
Test #26:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
999999999954
output:
516560849
result:
ok 1 number(s): "516560849"
Test #27:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
999999999955
output:
516560851
result:
ok 1 number(s): "516560851"
Test #28:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
999999999956
output:
516560853
result:
ok 1 number(s): "516560853"
Test #29:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
999999999957
output:
516560855
result:
ok 1 number(s): "516560855"
Test #30:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
999999999958
output:
516560857
result:
ok 1 number(s): "516560857"
Test #31:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
999999999959
output:
516560859
result:
ok 1 number(s): "516560859"
Test #32:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
999999999960
output:
516560861
result:
ok 1 number(s): "516560861"
Test #33:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
999999999961
output:
516560863
result:
ok 1 number(s): "516560863"
Test #34:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
999999999962
output:
516560865
result:
ok 1 number(s): "516560865"
Test #35:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
999999999963
output:
516560867
result:
ok 1 number(s): "516560867"
Test #36:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
999999999964
output:
516560869
result:
ok 1 number(s): "516560869"
Test #37:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
999999999965
output:
516560871
result:
ok 1 number(s): "516560871"
Test #38:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
999999999966
output:
516560873
result:
ok 1 number(s): "516560873"
Test #39:
score: 0
Accepted
time: 1ms
memory: 3792kb
input:
999999999967
output:
516560875
result:
ok 1 number(s): "516560875"
Test #40:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
999999999968
output:
516560877
result:
ok 1 number(s): "516560877"
Test #41:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
999999999969
output:
516560879
result:
ok 1 number(s): "516560879"
Test #42:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
999999999970
output:
516560881
result:
ok 1 number(s): "516560881"
Test #43:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
999999999971
output:
516560883
result:
ok 1 number(s): "516560883"
Test #44:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
999999999972
output:
516560885
result:
ok 1 number(s): "516560885"
Test #45:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
999999999973
output:
516560887
result:
ok 1 number(s): "516560887"
Test #46:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
999999999974
output:
516560889
result:
ok 1 number(s): "516560889"
Test #47:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
999999999975
output:
516560891
result:
ok 1 number(s): "516560891"
Test #48:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
999999999976
output:
516560893
result:
ok 1 number(s): "516560893"
Test #49:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
999999999977
output:
516560895
result:
ok 1 number(s): "516560895"
Test #50:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
999999999978
output:
516560897
result:
ok 1 number(s): "516560897"
Test #51:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
999999999979
output:
516560899
result:
ok 1 number(s): "516560899"
Test #52:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
999999999980
output:
516560901
result:
ok 1 number(s): "516560901"
Test #53:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
999999999981
output:
516560903
result:
ok 1 number(s): "516560903"
Test #54:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
999999999982
output:
516560905
result:
ok 1 number(s): "516560905"
Test #55:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
999999999983
output:
516560907
result:
ok 1 number(s): "516560907"
Test #56:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
999999999984
output:
516560909
result:
ok 1 number(s): "516560909"
Test #57:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
999999999985
output:
516560911
result:
ok 1 number(s): "516560911"
Test #58:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
999999999986
output:
516560913
result:
ok 1 number(s): "516560913"
Test #59:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
999999999987
output:
516560915
result:
ok 1 number(s): "516560915"
Test #60:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
999999999988
output:
516560917
result:
ok 1 number(s): "516560917"
Test #61:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
999999999989
output:
516560919
result:
ok 1 number(s): "516560919"
Test #62:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
999999999990
output:
516560921
result:
ok 1 number(s): "516560921"
Test #63:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
999999999991
output:
516560923
result:
ok 1 number(s): "516560923"
Test #64:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
999999999992
output:
516560925
result:
ok 1 number(s): "516560925"
Test #65:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
999999999993
output:
516560927
result:
ok 1 number(s): "516560927"
Test #66:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
999999999994
output:
516560929
result:
ok 1 number(s): "516560929"
Test #67:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
999999999995
output:
516560931
result:
ok 1 number(s): "516560931"
Test #68:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
999999999996
output:
516560933
result:
ok 1 number(s): "516560933"
Test #69:
score: 0
Accepted
time: 1ms
memory: 3792kb
input:
999999999997
output:
516560935
result:
ok 1 number(s): "516560935"
Test #70:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
999999999998
output:
516560937
result:
ok 1 number(s): "516560937"
Test #71:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
999999999999
output:
516560939
result:
ok 1 number(s): "516560939"
Test #72:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
426789517863
output:
80113911
result:
ok 1 number(s): "80113911"
Test #73:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
863617123873
output:
271517056
result:
ok 1 number(s): "271517056"
Test #74:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
300438990906
output:
933125659
result:
ok 1 number(s): "933125659"
Test #75:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
741550086256
output:
707308307
result:
ok 1 number(s): "707308307"
Test #76:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
215252144633
output:
260973123
result:
ok 1 number(s): "260973123"
Test #77:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
652066018104
output:
424911190
result:
ok 1 number(s): "424911190"
Test #78:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
88874152603
output:
60810372
result:
ok 1 number(s): "60810372"
Test #79:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
566890854827
output:
774368999
result:
ok 1 number(s): "774368999"
Test #80:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
3696734746
output:
405759021
result:
ok 1 number(s): "405759021"
Test #81:
score: 0
Accepted
time: 1ms
memory: 3812kb
input:
526368807958
output:
588067854
result:
ok 1 number(s): "588067854"
Test #82:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
110521428
output:
221042856
result:
ok 1 number(s): "221042856"
Test #83:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
441203677050
output:
957590401
result:
ok 1 number(s): "957590401"
Test #84:
score: 0
Accepted
time: 1ms
memory: 3792kb
input:
877996126398
output:
80435869
result:
ok 1 number(s): "80435869"
Test #85:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
351757516426
output:
751008340
result:
ok 1 number(s): "751008340"
Test #86:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
788547711191
output:
867588995
result:
ok 1 number(s): "867588995"
Test #87:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
225332166993
output:
456130783
result:
ok 1 number(s): "456130783"
Test #88:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
666405851100
output:
155490945
result:
ok 1 number(s): "155490945"
Test #89:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
140190402081
output:
872385322
result:
ok 1 number(s): "872385322"
Test #90:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
576966864308
output:
961500901
result:
ok 1 number(s): "961500901"
Test #91:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
641038605112
output:
331460972
result:
ok 1 number(s): "331460972"
Test #92:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
114842730137
output:
89259084
result:
ok 1 number(s): "89259084"
Test #93:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
551611096290
output:
162182515
result:
ok 1 number(s): "162182515"
Test #94:
score: 0
Accepted
time: 1ms
memory: 3756kb
input:
988373723464
output:
223627988
result:
ok 1 number(s): "223627988"
Test #95:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
462197525047
output:
20779216
result:
ok 1 number(s): "20779216"
Test #96:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
903252864935
output:
681695293
result:
ok 1 number(s): "681695293"
Test #97:
score: 0
Accepted
time: 1ms
memory: 3524kb
input:
344302465869
output:
814572521
result:
ok 1 number(s): "814572521"
Test #98:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
818145943985
output:
169393403
result:
ok 1 number(s): "169393403"
Test #99:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
254898323042
output:
692026054
result:
ok 1 number(s): "692026054"
Test #100:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
691644963096
output:
721497287
result:
ok 1 number(s): "721497287"
Test #101:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
792808110182
output:
404187800
result:
ok 1 number(s): "404187800"
Test #102:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
229552393167
output:
910628307
result:
ok 1 number(s): "910628307"
Test #103:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
666290937145
output:
923907388
result:
ok 1 number(s): "923907388"
Test #104:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
103023742178
output:
409147638
result:
ok 1 number(s): "409147638"
Test #105:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
576909955285
output:
847682855
result:
ok 1 number(s): "847682855"
Test #106:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
17935473032
output:
932393709
result:
ok 1 number(s): "932393709"
Test #107:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
454660284472
output:
918207714
result:
ok 1 number(s): "918207714"
Test #108:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
928566174135
output:
397851690
result:
ok 1 number(s): "397851690"
Test #109:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
369583698324
output:
466575428
result:
ok 1 number(s): "466575428"
Test #110:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
806300516203
output:
436402311
result:
ok 1 number(s): "436402311"
Test #111:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
903230082399
output:
636130221
result:
ok 1 number(s): "636130221"