QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#397973#6110. Squirrel Gamebinminh01AC ✓6ms4420kbC++236.5kb2024-04-24 20:47:312024-04-24 20:47:31

Judging History

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

  • [2024-04-24 20:47:31]
  • 评测
  • 测评结果:AC
  • 用时:6ms
  • 内存:4420kb
  • [2024-04-24 20:47:31]
  • 提交

answer

#pragma GCC optimize("Ofast,unroll-loops")
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define int128 __int128_t
#define double long double
#define gcd __gcd
#define lcm(a, b) ((a)/gcd(a, b)*(b))
#define sqrt sqrtl
#define log2 log2l
#define log10 log10l
#define floor floorl
#define to_string str
#define yes cout << "YES"
#define no cout << "NO"
#define trav(i, a) for (auto &i: (a))
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)a.size()
#define Max(a) *max_element(all(a))
#define Min(a) *min_element(all(a))
#define Find(a, n) (find(all(a), n) - a.begin())
#define Count(a, n) count(all(a), n)
#define Upper(a, n) (upper_bound(all(a), n) - a.begin())
#define Lower(a, n) (lower_bound(all(a), n) - a.begin())
#define next_perm(a) next_permutation(all(a))
#define prev_perm(a) prev_permutation(all(a))
#define sorted(a) is_sorted(all(a))
#define sum(a) accumulate(all(a), 0)
#define sumll(a) accumulate(all(a), 0ll)
#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define Unique(a) Sort(a), (a).resize(unique(all(a)) - a.begin())
#define pb push_back
#define eb emplace_back
#define open(s) freopen(s, "r", stdin)
#define write(s) freopen(s, "w", stdout)
#define fileopen(s) open((string(s) + ".inp").c_str()), write((string(s) + ".out").c_str());
#define For(i, a, b) for (auto i = (a); i < (b); i++)
#define Fore(i, a, b) for (auto i = (a); i >= (b); i--)
#define FOR(i, a, b) for (auto i = (a); i <= (b); i++)
#define ret(s) return void(cout << s);

const int mod = 1e9 + 7, mod2 = 998244353;
const double PI = acos(-1), eps = 1e-9;
const ull npos = string::npos;
const int dx[] = {0, 0, -1, 1}, dy[] = {-1, 1, 0, 0};
using pii = pair<int, int>;
using pll = pair<ll, ll>;
mt19937 mt(chrono::system_clock::now().time_since_epoch().count());
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<double> vdo;
typedef vector<vdo> vvdo;
typedef vector<string> vs;
typedef vector<pii> vpair;
typedef vector<vpair> vvpair;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef priority_queue<int> pq;
typedef priority_queue<int, vi, greater<int>> pqg;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vll, greater<ll>> pqgll;
 
ll power(ll a, ll b, int m){ll x = 1;a%=m;while (b) {if (b & 1) x = x*a % m;a = a*a % m;b>>=1;}return x;}
ll power(ll a, ll b){ll x = 1;while (b) {if (b & 1) x = x*a;a = a*a;b>>=1;}return x;}
ll ceil(ll a, ll b){return (a + b - 1)/b;}
ll to_int(const string &s){ll x = 0; for (int i = (s[0] == '-'); i < sz(s); i++) x = x*10 + s[i] - '0';return x*(s[0] == '-' ? -1: 1);}
bool is_prime(ll n) {if (n < 2) return 0;if (n < 4) return 1;if (n % 2 == 0 || n % 3 == 0) return 0;for (ll i = 5; i*i <= n; i+=6) {if(n % i == 0 || n % (i + 2) == 0) return 0;}return 1;}
bool is_square(ll n) {ll k = sqrt(n); return k*k == n;}
ll factorial(int n) {ll x = 1;for (int i = 2; i <= n; i++) x*=i;return x;}
ll factorial(int n, int m) {ll x = 1;for (ll i = 2; i <= n; i++) x = x*i % m;return x;}
bool is_power(ll n, ll k) {while (n % k == 0) n/=k;return n == 1ll;}
string str(ll n) {if (n == 0) return "0"; string s = ""; bool c = 0; if (n < 0) c = 1, n = -n; while (n) {s+=n % 10 + '0'; n/=10;} if (c) s+='-'; Reverse(s); return s;}
string repeat(const string &s, int n) {if (n < 0) return ""; string x = ""; while (n--) x+=s; return x;}
string bin(ll n) {string s = ""; while (n) {s+=(n & 1) + '0'; n>>=1;} Reverse(s); return s;}
void sieve(vector<bool> &a) {int n = a.size(); a[0] = a[1] = 0; for (int i = 4; i < n; i+=2) a[i] = 0; for (int i = 3; i*i < n; i+=2) {if (a[i]) {for (int j = i*i; j < n; j+=(i << 1)) a[j] = 0;}}}
void sieve(vector<int> &a) {int n = a.size(); for (int i = 2; i < n; i+=2) a[i] = 2; for (int i = 3; i*i < n; i+=2) {if (!a[i]) {for (int j = i; j < n; j+=(i << 1)) a[j] = i;}} for (int i = 3; i < n; i+=2) {if (!a[i]) a[i] = i;}}
void sieve(int a[], int n) {for (int i = 2; i < n; i+=2) a[i] = 2; for (int i = 3; i*i < n; i+=2) {if (!a[i]) {for (int j = i; j < n; j+=(i << 1)) a[j] = i;}} for (int i = 3; i < n; i+=2) {if (!a[i]) a[i] = i;}}
vector<pii> factorize(int n) {vector<pii> a; for (int i = 2; i*i <= n; i++) {if (n % i == 0) {int k = 0; while (n % i == 0) k++, n/=i; a.emplace_back(i, k);}} if (n > 1) a.emplace_back(n, 1); return a;}
int rand(int l, int r) {return uniform_int_distribution<int>(l, r)(mt);}
int Log2(int n) {return 31 - __builtin_clz(n);}
template<class T> void compress(vector<T> &a) {vector<T> b; for (T &i: a) b.push_back(i); sort(all(b)); b.resize(unique(all(b)) - b.begin()); for (T &i: a) i = lower_bound(all(b), i) - b.begin() + 1;}

template<class A, class B> istream& operator>>(istream& in, pair<A, B> &p) {in >> p.first >> p.second; return in;}
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &p) {out << p.first << ' ' << p.second; return out;}
template<class T> istream& operator>>(istream& in, vector<T> &a) {for (auto &i: a) in >> i; return in;}
template<class T> ostream& operator<<(ostream& out, const vector<T> &a) {for (auto &i: a) out << i << ' '; return out;}
template<class T> istream& operator>>(istream& in, vector<vector<T>> &a) {for (auto &i: a) in >> i; return in;}
template<class T> ostream& operator<<(ostream& out, const vector<vector<T>> &a) {for (auto &i: a) out << i << '\n'; return out;}
template<class T> istream& operator>>(istream& in, deque<T> &a) {for (auto &i: a) in >> i; return in;}
template<class T> ostream& operator<<(ostream& out, const deque<T> &a) {for (auto &i: a) out << i << ' '; return out;}
// istream& operator>>(istream& in, __int128_t &a) {string s; in >> s; a = 0; for (auto &i: s) a = a*10 + (i - '0'); return in;}
// ostream& operator<<(ostream& out, __int128_t a) {string s = ""; while (a > 0) {s+=(int)a % 10 + '0'; a/=10;} Reverse(s); out << s; return out;}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    cout << fixed << setprecision(10);
    int m, n, k; cin >> m >> n >> k;
    vi a(n); cin >> a;
    if (n == 1) {
        if (a[0] == 1) cout << "Nova";
        else cout << "Twinkle";
        return 0;
    }
    vvi c(k);
    c[k - 1].pb(a[0] - 1);
    For(i,0,n-1) c[i % k].pb(a[i + 1] - a[i] - 1);
    int x = 0;
    For(i,0,k){
        if (c[i].empty()) continue;
        int t = sz(c[i]) - 1;
        for (int j = t % 2; j <= t; j+=2) x^=c[i][j];
    }
    if (x) cout << "Twinkle";
    else cout << "Nova";
    return 0;
}

详细

Test #1:

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

input:

7 3 2
1 4 7

output:

Nova

result:

ok single line: 'Nova'

Test #2:

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

input:

7 3 1
1 4 7

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #3:

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

input:

1 1 1
1

output:

Nova

result:

ok single line: 'Nova'

Test #4:

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

input:

1 1 10
1

output:

Nova

result:

ok single line: 'Nova'

Test #5:

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

input:

100000 1 1
19593

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #6:

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

input:

100000 1 10
62516

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #7:

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

input:

100 10 1
23 24 43 47 62 66 68 73 82 85

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #8:

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

input:

100 10 3
11 18 23 26 30 40 52 76 78 99

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #9:

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

input:

100 10 7
14 27 51 62 66 71 75 79 80 97

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #10:

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

input:

100 10 10
10 18 25 50 51 54 64 77 95 96

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #11:

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

input:

100 5 10
15 52 61 65 78

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #12:

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

input:

10 10 1
1 2 3 4 5 6 7 8 9 10

output:

Nova

result:

ok single line: 'Nova'

Test #13:

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

input:

10 10 3
1 2 3 4 5 6 7 8 9 10

output:

Nova

result:

ok single line: 'Nova'

Test #14:

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

input:

100 10 1
5 16 25 28 39 49 58 63 79 85

output:

Nova

result:

ok single line: 'Nova'

Test #15:

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

input:

100 10 3
11 18 28 37 51 68 78 86 88 90

output:

Nova

result:

ok single line: 'Nova'

Test #16:

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

input:

100 10 7
10 20 32 44 55 64 66 73 83 91

output:

Nova

result:

ok single line: 'Nova'

Test #17:

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

input:

100 10 10
6 9 20 23 31 38 48 55 58 62

output:

Nova

result:

ok single line: 'Nova'

Test #18:

score: 0
Accepted
time: 2ms
memory: 4196kb

input:

100000 99989 1
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 ...

output:

Nova

result:

ok single line: 'Nova'

Test #19:

score: 0
Accepted
time: 2ms
memory: 4420kb

input:

100000 99989 9
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 ...

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #20:

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

input:

100000 100 1
1585 3708 4825 5521 10036 10669 11878 12078 12547 12849 13324 15459 15499 15818 15871 17032 17412 18426 18538 18639 19665 21470 22304 22476 23107 23858 24844 27236 27286 28294 28688 30590 31204 32451 32711 34289 35800 36665 36974 40640 40899 41074 43977 44108 44210 44418 47233 48247 514...

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #21:

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

input:

100000 100 3
533 620 683 2157 2382 2617 3965 4810 7922 9768 10045 10228 10502 10807 11390 12331 13553 14049 14829 15902 16019 16498 18617 19244 19879 20141 20346 25262 25382 26840 28045 28777 30601 31175 31378 31421 34047 34631 36336 39981 40013 41134 41505 44450 45535 46096 46404 46710 51291 51546 ...

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #22:

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

input:

100000 100 7
1426 2304 5883 10070 10753 11723 12141 12206 12981 15835 17442 17949 18691 19585 21157 22242 22426 23104 24299 24536 27787 28059 28652 29035 29060 31882 31967 32873 33438 35783 35851 36139 37987 39548 42121 43699 47102 48793 49298 49509 50234 52137 52255 53732 54027 54867 55311 55451 56...

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #23:

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

input:

100000 100 10
16 743 2508 6315 6889 7672 8471 8630 9993 10122 11580 12140 13528 13790 14024 17808 18693 18697 19019 19817 19958 20210 20987 22313 22736 25442 28377 28702 30520 30777 30899 34352 36578 37754 38024 39242 39806 40793 40893 41167 41241 42515 44425 45324 45650 46108 46696 47022 47337 4746...

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #24:

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

input:

100000 19999 1
2 16 25 29 36 40 44 48 54 60 61 64 69 89 101 103 111 114 115 126 127 128 134 138 139 157 162 166 170 171 177 180 182 183 184 192 197 198 200 206 209 211 212 215 218 219 221 223 224 227 237 239 245 258 262 267 272 280 292 293 298 300 302 307 308 315 322 326 327 328 332 333 344 349 363 ...

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #25:

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

input:

100000 19999 3
1 9 14 17 30 31 34 50 51 52 56 58 61 65 70 71 81 83 90 97 104 105 129 134 135 136 150 155 157 165 168 169 170 174 176 177 182 185 186 191 194 202 207 214 215 221 222 226 230 237 240 243 250 251 254 257 261 270 275 284 285 286 287 297 301 312 318 325 333 336 339 341 350 355 356 358 361...

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #26:

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

input:

100000 19999 7
7 14 25 31 34 37 39 41 46 48 52 53 60 64 67 80 87 89 91 94 101 103 107 110 119 120 126 129 132 133 145 148 151 155 156 175 176 186 187 189 192 193 194 196 205 215 218 224 232 235 240 246 248 250 254 258 259 260 262 266 267 278 291 298 304 305 312 319 322 328 329 330 339 341 345 359 36...

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #27:

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

input:

100000 19999 10
1 2 3 8 13 15 22 27 32 36 37 38 40 43 44 48 53 57 63 64 76 92 94 96 98 100 106 108 112 121 131 135 139 144 160 163 164 166 168 170 174 177 181 191 194 195 201 202 214 215 221 227 238 249 251 257 262 277 278 279 290 295 296 297 300 304 317 322 323 326 337 345 348 359 360 373 379 391 3...

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #28:

score: 0
Accepted
time: 5ms
memory: 4296kb

input:

100000 100000 1
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...

output:

Nova

result:

ok single line: 'Nova'

Test #29:

score: 0
Accepted
time: 6ms
memory: 4212kb

input:

100000 100000 9
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...

output:

Nova

result:

ok single line: 'Nova'

Test #30:

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

input:

100000 100 1
1477 2422 3979 4026 5436 5440 6999 7504 9005 9696 11210 12006 13533 14494 16022 16591 18058 18144 19665 20277 21767 22404 23868 24596 26089 26728 28297 28670 30154 30237 31663 32239 33737 34606 36146 37073 38493 39342 40862 41638 43175 43865 45355 45408 46928 47677 49161 49582 51071 518...

output:

Nova

result:

ok single line: 'Nova'

Test #31:

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

input:

100000 100 3
1452 2160 3017 3422 4967 6501 7941 8334 8705 9639 11104 12577 14111 14548 14934 15016 16472 17974 19398 20177 21015 21496 22861 24296 25830 25891 26189 26311 27768 29238 30663 31592 32511 33396 34844 36338 37787 38056 38215 38787 40242 41701 43087 43732 44690 45529 46993 48439 49845 499...

output:

Nova

result:

ok single line: 'Nova'

Test #32:

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

input:

100000 100 7
978 1536 3102 4697 6290 7891 9495 11049 12559 12804 12973 13084 13264 13753 14237 14720 16242 17763 19284 20936 22551 24067 25744 25907 25965 26507 26617 27605 28449 28821 30368 31882 33511 35127 36703 38302 39847 40205 40742 41060 41841 41997 42551 42706 44265 45862 47445 49063 50603 5...

output:

Nova

result:

ok single line: 'Nova'

Test #33:

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

input:

100000 100 10
1399 2819 4208 5644 7052 8466 9817 11259 12611 13997 14593 15516 16289 16401 16948 17800 18015 18104 19077 19589 21015 22459 23955 25372 26789 28209 29625 30964 32348 33811 34640 34711 35142 35279 36084 36988 37225 37665 38371 38557 39953 41398 42771 44189 45618 47062 48475 49887 51292...

output:

Nova

result:

ok single line: 'Nova'

Test #34:

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

input:

100000 999 1
14 169 261 395 406 561 662 829 911 1073 1092 1231 1283 1441 1526 1679 1754 1902 1904 2034 2085 2225 2252 2373 2381 2532 2567 2726 2784 2953 2984 3148 3201 3361 3383 3522 3617 3773 3860 4004 4084 4223 4279 4431 4471 4606 4696 4842 4894 5049 5110 5279 5310 5463 5476 5609 5610 5765 5817 59...

output:

Nova

result:

ok single line: 'Nova'

Test #35:

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

input:

100000 999 3
115 136 146 295 455 625 654 719 733 884 1015 1181 1248 1294 1308 1466 1608 1760 1844 1921 1997 2154 2287 2440 2534 2560 2611 2758 2913 3077 3105 3188 3230 3381 3520 3688 3756 3785 3834 3989 4132 4260 4347 4349 4425 4564 4730 4880 4961 5002 5098 5251 5401 5543 5564 5638 5678 5816 5961 60...

output:

Nova

result:

ok single line: 'Nova'

Test #36:

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

input:

100000 999 7
53 131 183 196 203 344 504 647 802 925 1068 1215 1265 1322 1407 1417 1469 1482 1531 1685 1840 2021 2182 2344 2501 2638 2730 2777 2807 2856 2927 3013 3056 3217 3346 3488 3650 3804 3928 4078 4102 4155 4196 4206 4236 4326 4382 4543 4692 4843 4987 5149 5280 5435 5509 5585 5618 5700 5764 580...

output:

Nova

result:

ok single line: 'Nova'

Test #37:

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

input:

100000 999 10
159 308 477 617 737 887 1055 1210 1359 1363 1444 1476 1544 1637 1657 1738 1758 1838 1914 2052 2207 2367 2511 2662 2814 2949 3097 3243 3399 3409 3441 3464 3565 3659 3702 3794 3804 3887 3915 4073 4221 4372 4531 4666 4822 4985 5138 5272 5421 5497 5573 5668 5711 5809 5814 5892 5913 5975 60...

output:

Nova

result:

ok single line: 'Nova'

Test #38:

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

input:

100000 5 10
1661 3888 64309 79490 85369

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #39:

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

input:

100000 9 10
6680 33729 38078 46137 58324 59179 62144 74095 75181

output:

Twinkle

result:

ok single line: 'Twinkle'

Test #40:

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

input:

100000 1 10
1

output:

Nova

result:

ok single line: 'Nova'

Test #41:

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

input:

100000 5 10
16135 17403 22925 31665 34809

output:

Nova

result:

ok single line: 'Nova'

Test #42:

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

input:

100000 9 10
15729 17655 24621 25718 34877 36879 42217 45696 52049

output:

Nova

result:

ok single line: 'Nova'