Skip to content

Commit 7eee989

Browse files
author
Koral Kulacoglu
committed
div3 contest almost full-solved
1 parent dd4f3b7 commit 7eee989

12 files changed

Lines changed: 978 additions & 0 deletions

File tree

CodeForces/Contests/1109/3/A

38.1 KB
Binary file not shown.

CodeForces/Contests/1109/3/A.cpp

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
/*
2+
ID: Koral Kulacoglu
3+
TASK: test
4+
LANG: C++
5+
*/
6+
7+
#pragma GCC optimize("O3")
8+
#pragma GCC target("sse4")
9+
10+
#include <bits/stdc++.h>
11+
12+
using namespace std;
13+
14+
typedef long long ll;
15+
typedef long double ld;
16+
typedef unsigned long long ull;
17+
typedef long double lld;
18+
typedef complex<ld> cd;
19+
20+
typedef pair<int, int> pi;
21+
typedef pair<ll, ll> pll;
22+
typedef pair<ld, ld> pld;
23+
24+
typedef vector<int> vi;
25+
typedef vector<string> vs;
26+
typedef vector<char> vc;
27+
typedef vector<ld> vld;
28+
typedef vector<ll> vll;
29+
typedef vector<pi> vpi;
30+
typedef vector<pll> vpll;
31+
typedef vector<cd> vcd;
32+
33+
template <class T> using pq = priority_queue<T>;
34+
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
35+
36+
#define FOR(i, a, b) for (int i = a; i < (b); i++)
37+
#define F0R(i, a) for (int i = 0; i < (a); i++)
38+
#define FORd(i, a, b) for (int i = (a) - 1; i >= b; i--)
39+
#define F0Rd(i, a) for (int i = (a) - 1; i >= 0; i--)
40+
#define trav(a, x) for (auto &a : x)
41+
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
42+
43+
#define sz(x) (int)(x).size()
44+
#define all(x) x.begin(), x.end()
45+
#define mp make_pair
46+
#define pb push_back
47+
#define fir first
48+
#define sec second
49+
#define ins insert
50+
#define lbound(a, v) lower_bound(all(a), v) - a.begin()
51+
#define ubound(a, v) upper_bound(all(a), v) - a.begin()
52+
#define gcd(a, b) __gcd(a, b)
53+
#define lcm(a, b) (a * b) / gcd(a, b)
54+
55+
template <class T> bool ckmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
56+
template <class T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
57+
58+
void __print(int x) { cerr << x; }
59+
void __print(long x) { cerr << x; }
60+
void __print(long long x) { cerr << x; }
61+
void __print(unsigned x) { cerr << x; }
62+
void __print(unsigned long x) { cerr << x; }
63+
void __print(unsigned long long x) { cerr << x; }
64+
void __print(float x) { cerr << x; }
65+
void __print(double x) { cerr << x; }
66+
void __print(long double x) { cerr << x; }
67+
void __print(char x) { cerr << '\'' << x << '\''; }
68+
void __print(const char *x) { cerr << '\"' << x << '\"'; }
69+
void __print(const string &x) { cerr << '\"' << x << '\"'; }
70+
void __print(bool x) { cerr << (x ? "true" : "false"); }
71+
72+
template <typename T, typename V> void __print(const pair<T, V> &x);
73+
template <typename T> void __print(const T &x) {
74+
int f = 0;
75+
cerr << '{';
76+
for (auto &i : x)
77+
cerr << (f++ ? ", " : ""), __print(i);
78+
cerr << "}";
79+
}
80+
template <typename T, typename V> void __print(const pair<T, V> &x) {
81+
cerr << '{';
82+
__print(x.first);
83+
cerr << ", ";
84+
__print(x.second);
85+
cerr << '}';
86+
}
87+
void _print() { cerr << "]\n"; }
88+
template <typename T, typename... V> void _print(T t, V... v) {
89+
__print(t);
90+
if (sizeof...(v))
91+
cerr << ", ";
92+
_print(v...);
93+
}
94+
95+
#ifdef DEBUG
96+
#define dbg(x...) \
97+
cerr << __func__ << ":" << __LINE__ << " [" << #x << "] = ["; \
98+
_print(x); \
99+
cerr << endl;
100+
#else
101+
#define dbg(x...)
102+
#endif
103+
104+
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
105+
106+
struct custom_hash {
107+
size_t operator()(uint64_t x) const {
108+
x ^= rng();
109+
return x ^ (x >> 16);
110+
}
111+
};
112+
113+
const int MOD = 1000000007;
114+
const char nl = '\n';
115+
const int MX = 100001;
116+
117+
void solve() {
118+
int n;
119+
cin >> n;
120+
string s;
121+
cin >> s;
122+
123+
int ans = 0;
124+
int cur = 0;
125+
for (char c : s) {
126+
if (c == '#')
127+
cur++;
128+
else
129+
cur = 0;
130+
ckmax(ans, (cur + 1) / 2);
131+
}
132+
133+
cout << ans << nl;
134+
}
135+
136+
int main() {
137+
cin.tie(0)->sync_with_stdio(0);
138+
cin.exceptions(cin.failbit);
139+
140+
int T = 1;
141+
cin >> T;
142+
while (T--) {
143+
solve();
144+
}
145+
146+
return 0;
147+
}

CodeForces/Contests/1109/3/B

37.8 KB
Binary file not shown.

CodeForces/Contests/1109/3/B.cpp

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
ID: Koral Kulacoglu
3+
TASK: test
4+
LANG: C++
5+
*/
6+
7+
#pragma GCC optimize("O3")
8+
#pragma GCC target("sse4")
9+
10+
#include <bits/stdc++.h>
11+
12+
using namespace std;
13+
14+
typedef long long ll;
15+
typedef long double ld;
16+
typedef unsigned long long ull;
17+
typedef long double lld;
18+
typedef complex<ld> cd;
19+
20+
typedef pair<int, int> pi;
21+
typedef pair<ll, ll> pll;
22+
typedef pair<ld, ld> pld;
23+
24+
typedef vector<int> vi;
25+
typedef vector<string> vs;
26+
typedef vector<char> vc;
27+
typedef vector<ld> vld;
28+
typedef vector<ll> vll;
29+
typedef vector<pi> vpi;
30+
typedef vector<pll> vpll;
31+
typedef vector<cd> vcd;
32+
33+
template <class T> using pq = priority_queue<T>;
34+
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
35+
36+
#define FOR(i, a, b) for (int i = a; i < (b); i++)
37+
#define F0R(i, a) for (int i = 0; i < (a); i++)
38+
#define FORd(i, a, b) for (int i = (a) - 1; i >= b; i--)
39+
#define F0Rd(i, a) for (int i = (a) - 1; i >= 0; i--)
40+
#define trav(a, x) for (auto &a : x)
41+
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
42+
43+
#define sz(x) (int)(x).size()
44+
#define all(x) x.begin(), x.end()
45+
#define mp make_pair
46+
#define pb push_back
47+
#define fir first
48+
#define sec second
49+
#define ins insert
50+
#define lbound(a, v) lower_bound(all(a), v) - a.begin()
51+
#define ubound(a, v) upper_bound(all(a), v) - a.begin()
52+
#define gcd(a, b) __gcd(a, b)
53+
#define lcm(a, b) (a * b) / gcd(a, b)
54+
55+
template <class T> bool ckmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
56+
template <class T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
57+
58+
void __print(int x) { cerr << x; }
59+
void __print(long x) { cerr << x; }
60+
void __print(long long x) { cerr << x; }
61+
void __print(unsigned x) { cerr << x; }
62+
void __print(unsigned long x) { cerr << x; }
63+
void __print(unsigned long long x) { cerr << x; }
64+
void __print(float x) { cerr << x; }
65+
void __print(double x) { cerr << x; }
66+
void __print(long double x) { cerr << x; }
67+
void __print(char x) { cerr << '\'' << x << '\''; }
68+
void __print(const char *x) { cerr << '\"' << x << '\"'; }
69+
void __print(const string &x) { cerr << '\"' << x << '\"'; }
70+
void __print(bool x) { cerr << (x ? "true" : "false"); }
71+
72+
template <typename T, typename V> void __print(const pair<T, V> &x);
73+
template <typename T> void __print(const T &x) {
74+
int f = 0;
75+
cerr << '{';
76+
for (auto &i : x)
77+
cerr << (f++ ? ", " : ""), __print(i);
78+
cerr << "}";
79+
}
80+
template <typename T, typename V> void __print(const pair<T, V> &x) {
81+
cerr << '{';
82+
__print(x.first);
83+
cerr << ", ";
84+
__print(x.second);
85+
cerr << '}';
86+
}
87+
void _print() { cerr << "]\n"; }
88+
template <typename T, typename... V> void _print(T t, V... v) {
89+
__print(t);
90+
if (sizeof...(v))
91+
cerr << ", ";
92+
_print(v...);
93+
}
94+
95+
#ifdef DEBUG
96+
#define dbg(x...) \
97+
cerr << __func__ << ":" << __LINE__ << " [" << #x << "] = ["; \
98+
_print(x); \
99+
cerr << endl;
100+
#else
101+
#define dbg(x...)
102+
#endif
103+
104+
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
105+
106+
struct custom_hash {
107+
size_t operator()(uint64_t x) const {
108+
x ^= rng();
109+
return x ^ (x >> 16);
110+
}
111+
};
112+
113+
const int MOD = 1000000007;
114+
const char nl = '\n';
115+
const int MX = 100001;
116+
117+
void solve() {
118+
int n;
119+
cin >> n;
120+
vll a(n);
121+
FOR(i, 0, n) cin >> a[i];
122+
123+
ll extra = 0;
124+
FOR(i, 0, n) {
125+
a[i] += extra;
126+
127+
if (a[i] < (i + 1)) {
128+
cout << "NO" << nl;
129+
return;
130+
}
131+
132+
extra = a[i] - (i + 1);
133+
}
134+
135+
cout << "YES" << nl;
136+
}
137+
138+
int main() {
139+
cin.tie(0)->sync_with_stdio(0);
140+
cin.exceptions(cin.failbit);
141+
142+
int T = 1;
143+
cin >> T;
144+
while (T--) {
145+
solve();
146+
}
147+
148+
return 0;
149+
}

CodeForces/Contests/1109/3/C

37.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)