# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
338664 | 2020-12-23T15:48:05 Z | Dymo | Nice sequence (IZhO18_sequence) | C++14 | 529 ms | 16612 KB |
#include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define pll pair<ll,ll> #define ff first #define ss second #define endl "\n" const ll maxn=2e6+5; const ll mod =998244353 ; const ll maxn1=51; const ll base=1e9; ll n, m; vector<ll> tp; bool dd[maxn]; ll ans[maxn]; ll ans1[maxn]; void dfs(ll u,ll mid) { // cout <<u<<endl; dd[u]=1; if (u+n<=mid&&!dd[u+n]) dfs(u+n,mid); if (u-m>=0&&!dd[u-m]) dfs(u-m,mid); tp.pb(u); } bool chk(ll mid) { tp.clear(); for (int i=0; i<=mid; i++) { dd[i]=0; } for (int i=0; i<=mid; i++) { if (dd[i]) continue; dfs(i,mid); } for (int i=0; i<tp.size(); i++) { ans1[tp[i]]=i; } for (int i=0; i<=mid; i++) { if (i+n<=mid&&ans1[i+n]>ans1[i]) return false; if (i-m>=0&&ans1[i-m]>ans1[i]) return false; } for (int i=1;i<=mid;i++) { ans[i]=ans1[i]-ans1[i-1]; } return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if (fopen("GIFT11.inp","r")) { freopen("GIFT11.inp","r",stdin); freopen("GIFT11.out","w",stdout); } ll t; cin>> t; while (t--) { cin>> n>>m ; ll l=0, h=maxn/10; while (l<=h) { ll mid=(l+h)/2; if (chk(mid)) l=mid+1; else h=mid-1; } cout <<h<<endl; for (int i=1; i<=h; i++) { cout <<ans[i]<<" "; } cout <<endl; // cout <<chk(100000); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 5224 KB | Ok |
2 | Correct | 27 ms | 5224 KB | Ok |
3 | Correct | 31 ms | 2408 KB | Ok |
4 | Correct | 26 ms | 2408 KB | Ok |
5 | Correct | 27 ms | 2408 KB | Ok |
6 | Correct | 26 ms | 2920 KB | Ok |
7 | Correct | 27 ms | 2408 KB | Ok |
8 | Correct | 27 ms | 2920 KB | Ok |
9 | Correct | 26 ms | 2280 KB | Ok |
10 | Correct | 27 ms | 3688 KB | Ok |
11 | Correct | 26 ms | 2280 KB | Ok |
12 | Correct | 26 ms | 2280 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 3688 KB | Ok |
2 | Correct | 26 ms | 3688 KB | Ok |
3 | Correct | 30 ms | 3688 KB | Ok |
4 | Correct | 28 ms | 3688 KB | Ok |
5 | Correct | 30 ms | 3688 KB | Ok |
6 | Correct | 29 ms | 3816 KB | Ok |
7 | Correct | 47 ms | 4328 KB | Ok |
8 | Correct | 36 ms | 3944 KB | Ok |
9 | Correct | 52 ms | 4456 KB | Ok |
10 | Correct | 40 ms | 4200 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 5224 KB | Ok |
2 | Correct | 27 ms | 5224 KB | Ok |
3 | Correct | 27 ms | 3688 KB | Ok |
4 | Correct | 26 ms | 3176 KB | Ok |
5 | Correct | 26 ms | 5224 KB | Ok |
6 | Correct | 28 ms | 5224 KB | Ok |
7 | Correct | 28 ms | 5224 KB | Ok |
8 | Correct | 28 ms | 5224 KB | Ok |
9 | Correct | 26 ms | 5224 KB | Ok |
10 | Correct | 26 ms | 3688 KB | Ok |
11 | Correct | 26 ms | 3176 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 3688 KB | Ok |
2 | Correct | 25 ms | 2536 KB | Ok |
3 | Correct | 25 ms | 2408 KB | Ok |
4 | Correct | 25 ms | 2280 KB | Ok |
5 | Correct | 25 ms | 2280 KB | Ok |
6 | Correct | 313 ms | 12900 KB | Ok |
7 | Correct | 279 ms | 13648 KB | Ok |
8 | Correct | 529 ms | 16612 KB | Ok |
9 | Correct | 384 ms | 14692 KB | Ok |
10 | Correct | 220 ms | 8548 KB | Ok |
11 | Correct | 340 ms | 15052 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 5224 KB | Ok |
2 | Correct | 27 ms | 5224 KB | Ok |
3 | Correct | 31 ms | 2408 KB | Ok |
4 | Correct | 26 ms | 2408 KB | Ok |
5 | Correct | 27 ms | 2408 KB | Ok |
6 | Correct | 26 ms | 2920 KB | Ok |
7 | Correct | 27 ms | 2408 KB | Ok |
8 | Correct | 27 ms | 2920 KB | Ok |
9 | Correct | 26 ms | 2280 KB | Ok |
10 | Correct | 27 ms | 3688 KB | Ok |
11 | Correct | 26 ms | 2280 KB | Ok |
12 | Correct | 26 ms | 2280 KB | Ok |
13 | Correct | 12 ms | 5224 KB | Ok |
14 | Correct | 27 ms | 5224 KB | Ok |
15 | Correct | 27 ms | 3688 KB | Ok |
16 | Correct | 26 ms | 3176 KB | Ok |
17 | Correct | 26 ms | 5224 KB | Ok |
18 | Correct | 28 ms | 5224 KB | Ok |
19 | Correct | 28 ms | 5224 KB | Ok |
20 | Correct | 28 ms | 5224 KB | Ok |
21 | Correct | 26 ms | 5224 KB | Ok |
22 | Correct | 26 ms | 3688 KB | Ok |
23 | Correct | 26 ms | 3176 KB | Ok |
24 | Correct | 33 ms | 2280 KB | Ok |
25 | Correct | 31 ms | 2280 KB | Ok |
26 | Correct | 34 ms | 2280 KB | Ok |
27 | Correct | 28 ms | 2280 KB | Ok |
28 | Correct | 29 ms | 2280 KB | Ok |
29 | Correct | 27 ms | 2280 KB | Ok |
30 | Correct | 27 ms | 2152 KB | Ok |
31 | Correct | 28 ms | 2280 KB | Ok |
32 | Correct | 31 ms | 2280 KB | Ok |
33 | Correct | 28 ms | 2280 KB | Ok |
34 | Correct | 36 ms | 2408 KB | Ok |
35 | Correct | 37 ms | 2408 KB | Ok |
36 | Correct | 41 ms | 2408 KB | Ok |
37 | Correct | 36 ms | 2408 KB | Ok |
38 | Correct | 35 ms | 2408 KB | Ok |
39 | Correct | 36 ms | 2408 KB | Ok |
40 | Correct | 42 ms | 2408 KB | Ok |
41 | Correct | 37 ms | 2408 KB | Ok |
42 | Correct | 36 ms | 2408 KB | Ok |
43 | Correct | 36 ms | 2408 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 5224 KB | Ok |
2 | Correct | 27 ms | 5224 KB | Ok |
3 | Correct | 31 ms | 2408 KB | Ok |
4 | Correct | 26 ms | 2408 KB | Ok |
5 | Correct | 27 ms | 2408 KB | Ok |
6 | Correct | 26 ms | 2920 KB | Ok |
7 | Correct | 27 ms | 2408 KB | Ok |
8 | Correct | 27 ms | 2920 KB | Ok |
9 | Correct | 26 ms | 2280 KB | Ok |
10 | Correct | 27 ms | 3688 KB | Ok |
11 | Correct | 26 ms | 2280 KB | Ok |
12 | Correct | 26 ms | 2280 KB | Ok |
13 | Correct | 26 ms | 3688 KB | Ok |
14 | Correct | 26 ms | 3688 KB | Ok |
15 | Correct | 30 ms | 3688 KB | Ok |
16 | Correct | 28 ms | 3688 KB | Ok |
17 | Correct | 30 ms | 3688 KB | Ok |
18 | Correct | 29 ms | 3816 KB | Ok |
19 | Correct | 47 ms | 4328 KB | Ok |
20 | Correct | 36 ms | 3944 KB | Ok |
21 | Correct | 52 ms | 4456 KB | Ok |
22 | Correct | 40 ms | 4200 KB | Ok |
23 | Correct | 12 ms | 5224 KB | Ok |
24 | Correct | 27 ms | 5224 KB | Ok |
25 | Correct | 27 ms | 3688 KB | Ok |
26 | Correct | 26 ms | 3176 KB | Ok |
27 | Correct | 26 ms | 5224 KB | Ok |
28 | Correct | 28 ms | 5224 KB | Ok |
29 | Correct | 28 ms | 5224 KB | Ok |
30 | Correct | 28 ms | 5224 KB | Ok |
31 | Correct | 26 ms | 5224 KB | Ok |
32 | Correct | 26 ms | 3688 KB | Ok |
33 | Correct | 26 ms | 3176 KB | Ok |
34 | Correct | 33 ms | 2280 KB | Ok |
35 | Correct | 31 ms | 2280 KB | Ok |
36 | Correct | 34 ms | 2280 KB | Ok |
37 | Correct | 28 ms | 2280 KB | Ok |
38 | Correct | 29 ms | 2280 KB | Ok |
39 | Correct | 27 ms | 2280 KB | Ok |
40 | Correct | 27 ms | 2152 KB | Ok |
41 | Correct | 28 ms | 2280 KB | Ok |
42 | Correct | 31 ms | 2280 KB | Ok |
43 | Correct | 28 ms | 2280 KB | Ok |
44 | Correct | 36 ms | 2408 KB | Ok |
45 | Correct | 37 ms | 2408 KB | Ok |
46 | Correct | 41 ms | 2408 KB | Ok |
47 | Correct | 36 ms | 2408 KB | Ok |
48 | Correct | 35 ms | 2408 KB | Ok |
49 | Correct | 36 ms | 2408 KB | Ok |
50 | Correct | 42 ms | 2408 KB | Ok |
51 | Correct | 37 ms | 2408 KB | Ok |
52 | Correct | 36 ms | 2408 KB | Ok |
53 | Correct | 36 ms | 2408 KB | Ok |
54 | Correct | 204 ms | 4584 KB | Ok |
55 | Correct | 236 ms | 4968 KB | Ok |
56 | Correct | 234 ms | 4840 KB | Ok |
57 | Correct | 184 ms | 4236 KB | Ok |
58 | Correct | 202 ms | 4456 KB | Ok |
59 | Correct | 194 ms | 4200 KB | Ok |
60 | Correct | 173 ms | 4072 KB | Ok |
61 | Correct | 187 ms | 4200 KB | Ok |
62 | Correct | 223 ms | 4712 KB | Ok |
63 | Correct | 189 ms | 4328 KB | Ok |
64 | Correct | 230 ms | 4968 KB | Ok |
65 | Correct | 207 ms | 4584 KB | Ok |
66 | Correct | 191 ms | 4456 KB | Ok |
67 | Correct | 172 ms | 4200 KB | Ok |
68 | Correct | 195 ms | 4456 KB | Ok |
69 | Correct | 385 ms | 12008 KB | Ok |
70 | Correct | 391 ms | 12776 KB | Ok |
71 | Correct | 376 ms | 12136 KB | Ok |
72 | Correct | 376 ms | 12008 KB | Ok |
73 | Correct | 375 ms | 12136 KB | Ok |
74 | Correct | 376 ms | 11880 KB | Ok |
75 | Correct | 382 ms | 11624 KB | Ok |
76 | Correct | 393 ms | 12392 KB | Ok |
77 | Correct | 369 ms | 11700 KB | Ok |
78 | Correct | 398 ms | 12248 KB | Ok |
79 | Correct | 373 ms | 12392 KB | Ok |
80 | Correct | 377 ms | 12532 KB | Ok |
81 | Correct | 395 ms | 12392 KB | Ok |
82 | Correct | 372 ms | 12136 KB | Ok |
83 | Correct | 363 ms | 11752 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 5224 KB | Ok |
2 | Correct | 27 ms | 5224 KB | Ok |
3 | Correct | 31 ms | 2408 KB | Ok |
4 | Correct | 26 ms | 2408 KB | Ok |
5 | Correct | 27 ms | 2408 KB | Ok |
6 | Correct | 26 ms | 2920 KB | Ok |
7 | Correct | 27 ms | 2408 KB | Ok |
8 | Correct | 27 ms | 2920 KB | Ok |
9 | Correct | 26 ms | 2280 KB | Ok |
10 | Correct | 27 ms | 3688 KB | Ok |
11 | Correct | 26 ms | 2280 KB | Ok |
12 | Correct | 26 ms | 2280 KB | Ok |
13 | Correct | 26 ms | 3688 KB | Ok |
14 | Correct | 26 ms | 3688 KB | Ok |
15 | Correct | 30 ms | 3688 KB | Ok |
16 | Correct | 28 ms | 3688 KB | Ok |
17 | Correct | 30 ms | 3688 KB | Ok |
18 | Correct | 29 ms | 3816 KB | Ok |
19 | Correct | 47 ms | 4328 KB | Ok |
20 | Correct | 36 ms | 3944 KB | Ok |
21 | Correct | 52 ms | 4456 KB | Ok |
22 | Correct | 40 ms | 4200 KB | Ok |
23 | Correct | 12 ms | 5224 KB | Ok |
24 | Correct | 27 ms | 5224 KB | Ok |
25 | Correct | 27 ms | 3688 KB | Ok |
26 | Correct | 26 ms | 3176 KB | Ok |
27 | Correct | 26 ms | 5224 KB | Ok |
28 | Correct | 28 ms | 5224 KB | Ok |
29 | Correct | 28 ms | 5224 KB | Ok |
30 | Correct | 28 ms | 5224 KB | Ok |
31 | Correct | 26 ms | 5224 KB | Ok |
32 | Correct | 26 ms | 3688 KB | Ok |
33 | Correct | 26 ms | 3176 KB | Ok |
34 | Correct | 26 ms | 3688 KB | Ok |
35 | Correct | 25 ms | 2536 KB | Ok |
36 | Correct | 25 ms | 2408 KB | Ok |
37 | Correct | 25 ms | 2280 KB | Ok |
38 | Correct | 25 ms | 2280 KB | Ok |
39 | Correct | 313 ms | 12900 KB | Ok |
40 | Correct | 279 ms | 13648 KB | Ok |
41 | Correct | 529 ms | 16612 KB | Ok |
42 | Correct | 384 ms | 14692 KB | Ok |
43 | Correct | 220 ms | 8548 KB | Ok |
44 | Correct | 340 ms | 15052 KB | Ok |
45 | Correct | 33 ms | 2280 KB | Ok |
46 | Correct | 31 ms | 2280 KB | Ok |
47 | Correct | 34 ms | 2280 KB | Ok |
48 | Correct | 28 ms | 2280 KB | Ok |
49 | Correct | 29 ms | 2280 KB | Ok |
50 | Correct | 27 ms | 2280 KB | Ok |
51 | Correct | 27 ms | 2152 KB | Ok |
52 | Correct | 28 ms | 2280 KB | Ok |
53 | Correct | 31 ms | 2280 KB | Ok |
54 | Correct | 28 ms | 2280 KB | Ok |
55 | Correct | 36 ms | 2408 KB | Ok |
56 | Correct | 37 ms | 2408 KB | Ok |
57 | Correct | 41 ms | 2408 KB | Ok |
58 | Correct | 36 ms | 2408 KB | Ok |
59 | Correct | 35 ms | 2408 KB | Ok |
60 | Correct | 36 ms | 2408 KB | Ok |
61 | Correct | 42 ms | 2408 KB | Ok |
62 | Correct | 37 ms | 2408 KB | Ok |
63 | Correct | 36 ms | 2408 KB | Ok |
64 | Correct | 36 ms | 2408 KB | Ok |
65 | Correct | 204 ms | 4584 KB | Ok |
66 | Correct | 236 ms | 4968 KB | Ok |
67 | Correct | 234 ms | 4840 KB | Ok |
68 | Correct | 184 ms | 4236 KB | Ok |
69 | Correct | 202 ms | 4456 KB | Ok |
70 | Correct | 194 ms | 4200 KB | Ok |
71 | Correct | 173 ms | 4072 KB | Ok |
72 | Correct | 187 ms | 4200 KB | Ok |
73 | Correct | 223 ms | 4712 KB | Ok |
74 | Correct | 189 ms | 4328 KB | Ok |
75 | Correct | 230 ms | 4968 KB | Ok |
76 | Correct | 207 ms | 4584 KB | Ok |
77 | Correct | 191 ms | 4456 KB | Ok |
78 | Correct | 172 ms | 4200 KB | Ok |
79 | Correct | 195 ms | 4456 KB | Ok |
80 | Correct | 385 ms | 12008 KB | Ok |
81 | Correct | 391 ms | 12776 KB | Ok |
82 | Correct | 376 ms | 12136 KB | Ok |
83 | Correct | 376 ms | 12008 KB | Ok |
84 | Correct | 375 ms | 12136 KB | Ok |
85 | Correct | 376 ms | 11880 KB | Ok |
86 | Correct | 382 ms | 11624 KB | Ok |
87 | Correct | 393 ms | 12392 KB | Ok |
88 | Correct | 369 ms | 11700 KB | Ok |
89 | Correct | 398 ms | 12248 KB | Ok |
90 | Correct | 373 ms | 12392 KB | Ok |
91 | Correct | 377 ms | 12532 KB | Ok |
92 | Correct | 395 ms | 12392 KB | Ok |
93 | Correct | 372 ms | 12136 KB | Ok |
94 | Correct | 363 ms | 11752 KB | Ok |
95 | Incorrect | 465 ms | 9208 KB | Jury has the better answer : jans = 239234, pans = 200000 |
96 | Halted | 0 ms | 0 KB | - |