File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /* *
2+ * @file 2225A.cpp
3+ * @author Macesuted (i@macesuted.moe)
4+ * @date 2026-04-21
5+ *
6+ * @copyright Copyright (c) 2026
7+ *
8+ */
9+
10+ #include < bits/stdc++.h>
11+ using namespace std ;
12+
13+ #ifndef LOCAL
14+ #define endl ' \n '
15+ #endif
16+
17+ bool mem1;
18+
19+ void solve (void ) {
20+ int64_t x, y;
21+ cin >> x >> y;
22+ for (int64_t z = 2 * x; z < y; z += x)
23+ if (y % z) return cout << " YES" << endl, void ();
24+ cout << " NO" << endl;
25+ return ;
26+ }
27+
28+ bool mem2;
29+
30+ int main () {
31+ ios::sync_with_stdio (false ), cin.tie (nullptr );
32+ #ifdef LOCAL
33+ cerr << " Memory Cost: " << abs (&mem1 - &mem2) / 1024 . / 1024 . << " MB" << endl;
34+ #endif
35+
36+ int _ = 1 ;
37+ cin >> _;
38+ while (_--) solve ();
39+
40+ #ifdef LOCAL
41+ cerr << " Time Cost: " << clock () * 1000 . / CLOCKS_PER_SEC << " MS" << endl;
42+ #endif
43+ return 0 ;
44+ }
Original file line number Diff line number Diff line change 1+ /* *
2+ * @file 2225B.cpp
3+ * @author Macesuted (i@macesuted.moe)
4+ * @date 2026-04-21
5+ *
6+ * @copyright Copyright (c) 2026
7+ *
8+ */
9+
10+ #include < bits/stdc++.h>
11+ using namespace std ;
12+
13+ #ifndef LOCAL
14+ #define endl ' \n '
15+ #endif
16+
17+ bool mem1;
18+
19+ void solve (void ) {
20+ string s;
21+ cin >> s;
22+ int n = s.size ();
23+
24+ int cnt = 0 ;
25+ for (int i = 1 ; i < n; i++) cnt += s[i] == s[i - 1 ];
26+
27+ cout << (cnt <= 2 ? " YES" : " NO" ) << endl;
28+
29+ return ;
30+ }
31+
32+ bool mem2;
33+
34+ int main () {
35+ ios::sync_with_stdio (false ), cin.tie (nullptr );
36+ #ifdef LOCAL
37+ cerr << " Memory Cost: " << abs (&mem1 - &mem2) / 1024 . / 1024 . << " MB" << endl;
38+ #endif
39+
40+ int _ = 1 ;
41+ cin >> _;
42+ while (_--) solve ();
43+
44+ #ifdef LOCAL
45+ cerr << " Time Cost: " << clock () * 1000 . / CLOCKS_PER_SEC << " MS" << endl;
46+ #endif
47+ return 0 ;
48+ }
Original file line number Diff line number Diff line change 1+ /* *
2+ * @file 2225C.cpp
3+ * @author Macesuted (i@macesuted.moe)
4+ * @date 2026-04-21
5+ *
6+ * @copyright Copyright (c) 2026
7+ *
8+ */
9+
10+ #include < bits/stdc++.h>
11+ using namespace std ;
12+
13+ #ifndef LOCAL
14+ #define endl ' \n '
15+ #endif
16+
17+ bool mem1;
18+
19+ void solve (void ) {
20+ int n;
21+ cin >> n;
22+ string s[2 ];
23+ cin >> s[0 ] >> s[1 ];
24+
25+ int f = INT64_MAX, g = 0 ;
26+ for (int i = 0 ; i < n; i++) {
27+ int ng = g + (s[0 ][i] != s[1 ][i]);
28+ if (i) ng = min (ng, f + (s[0 ][i - 1 ] != s[0 ][i]) + (s[1 ][i - 1 ] != s[1 ][i]));
29+ f = g, g = ng;
30+ }
31+
32+ cout << g << endl;
33+
34+ return ;
35+ }
36+
37+ bool mem2;
38+
39+ int main () {
40+ ios::sync_with_stdio (false ), cin.tie (nullptr );
41+ #ifdef LOCAL
42+ cerr << " Memory Cost: " << abs (&mem1 - &mem2) / 1024 . / 1024 . << " MB" << endl;
43+ #endif
44+
45+ int _ = 1 ;
46+ cin >> _;
47+ while (_--) solve ();
48+
49+ #ifdef LOCAL
50+ cerr << " Time Cost: " << clock () * 1000 . / CLOCKS_PER_SEC << " MS" << endl;
51+ #endif
52+ return 0 ;
53+ }
Original file line number Diff line number Diff line change 1+ /* *
2+ * @file 2225D.cpp
3+ * @author Macesuted (i@macesuted.moe)
4+ * @date 2026-04-21
5+ *
6+ * @copyright Copyright (c) 2026
7+ *
8+ */
9+
10+ #include < bits/stdc++.h>
11+ using namespace std ;
12+
13+ #ifndef LOCAL
14+ #define endl ' \n '
15+ #endif
16+
17+ bool mem1;
18+
19+ void solve (void ) {
20+ int64_t n, x;
21+ cin >> n >> x;
22+
23+ __int128_t l[2 ] = {((x - 1 ) >> 2 ) + 2 - (((x - 1 ) & 3 ) < 3 ), ((x - 1 ) >> 2 ) + 1 - (((x - 1 ) & 3 ) < 1 )},
24+ r[2 ] = {((n >> 2 ) + 2 - ((n & 3 ) < 3 )), (n >> 2 ) + 1 - ((n & 3 ) < 1 )};
25+ r[0 ] -= l[0 ], r[1 ] -= l[1 ];
26+
27+ cout << int64_t ((l[0 ] * r[0 ] + l[1 ] * r[1 ]) % 998244353 ) << endl;
28+
29+ return ;
30+ }
31+
32+ bool mem2;
33+
34+ int main () {
35+ ios::sync_with_stdio (false ), cin.tie (nullptr );
36+ #ifdef LOCAL
37+ cerr << " Memory Cost: " << abs (&mem1 - &mem2) / 1024 . / 1024 . << " MB" << endl;
38+ #endif
39+
40+ int _ = 1 ;
41+ cin >> _;
42+ while (_--) solve ();
43+
44+ #ifdef LOCAL
45+ cerr << " Time Cost: " << clock () * 1000 . / CLOCKS_PER_SEC << " MS" << endl;
46+ #endif
47+ return 0 ;
48+ }
Original file line number Diff line number Diff line change 1+ /* *
2+ * @file 2225G.cpp
3+ * @author Macesuted (i@macesuted.moe)
4+ * @date 2026-04-21
5+ *
6+ * @copyright Copyright (c) 2026
7+ *
8+ */
9+
10+ #include < bits/stdc++.h>
11+ using namespace std ;
12+
13+ #ifndef LOCAL
14+ #define endl ' \n '
15+ #endif
16+
17+ bool mem1;
18+
19+ int x[15 ];
20+ bool vis[5005 ];
21+
22+ void solve (void ) {
23+ int n, m;
24+ cin >> n >> m;
25+ for (int i = 1 ; i <= m; i++) cin >> x[i];
26+
27+ int g = x[1 ];
28+ for (int i = 2 ; i <= m; i++) g = gcd (g, x[i]);
29+
30+ if (g != 1 ) return cout << -1 << endl, void ();
31+
32+ sort (x + 1 , x + m + 1 );
33+
34+ for (int i = 0 ; i < n; i++) vis[i] = false ;
35+
36+ cout << 0 , vis[0 ] = true ;
37+
38+ for (int i = 1 , p = 0 ; i < n; i++) {
39+ int q = 0 ;
40+ for (int j = n - 1 ; j > 0 && !q; j--)
41+ if (!((j - p) % x[1 ]) && !vis[j]) q = j;
42+
43+ for (int i = 2 ; i <= m && !q; i++)
44+ if (!vis[p + x[i]]) q = p + x[i];
45+
46+ cout << ' ' << (p = q), vis[p] = true ;
47+ }
48+
49+ cout << endl;
50+
51+ return ;
52+ }
53+
54+ bool mem2;
55+
56+ int main () {
57+ ios::sync_with_stdio (false ), cin.tie (nullptr );
58+ #ifdef LOCAL
59+ cerr << " Memory Cost: " << abs (&mem1 - &mem2) / 1024 . / 1024 . << " MB" << endl;
60+ #endif
61+
62+ int _ = 1 ;
63+ cin >> _;
64+ while (_--) solve ();
65+
66+ #ifdef LOCAL
67+ cerr << " Time Cost: " << clock () * 1000 . / CLOCKS_PER_SEC << " MS" << endl;
68+ #endif
69+ return 0 ;
70+ }
You can’t perform that action at this time.
0 commit comments