buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
n,k,c = map(int,input().split()) s = input() fro = [] bac = [] for i in range(n): if s[i] == "o" and (len(fro) == 0 or fro[-1]+c < i): fro.append(i) if s[n-i-1] == "o" and (len(bac) == 0 or bac[-1]-c > n-i): bac.append(n-i-1) for i in range(k): if fro[i] == bac[-i-1]: print(fro[i]+...
n,k,c = map(int,input().split()) s = input() fro = [] bac = [] for i in range(n): if s[i] == "o" and (len(fro) == 0 or fro[-1]+c < i): fro.append(i) if s[n-i-1] == "o" and (len(bac) == 0 or bac[-1]-c > n-i-1): bac.append(n-i-1) for i in range(k): if fro[i] == bac[k-i-1]: print(fro[...
[["+", 12, 23, 0, 679, 12, 666, 0, 657, 17, 33], ["+", 12, 23, 0, 679, 12, 666, 0, 657, 12, 612], ["+", 15, 666, 0, 206, 206, 657, 31, 657, 31, 22]]
5
150
#include <bits/stdc++.h> #define ll long long #define ld long double #define F first #define S second //#define ONLINE_JUDGE 1 using namespace std; const int mod = 1e9 + 7; const int MAX = 100001; void pr(vector<int> v) { for (int x : v) { cout << x << " "; } cout << "\n"; } void solve() { int n, k, c...
#include <bits/stdc++.h> #define ll long long #define ld long double #define F first #define S second #define ONLINE_JUDGE 1 using namespace std; const int mod = 1e9 + 7; const int MAX = 100001; void pr(vector<int> v) { for (int x : v) { cout << x << " "; } cout << "\n"; } void solve() { int n, k, c; ...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
410
n, k, c = map(int, input().split()) s = input() dpl = [] dpr = [] ans = [] count = 0 i = 0 while count < k: if s[i]=="o": dpl.append(i) count += 1 i += c+1 else: i += 1 count = 0 i = n-1 while count < k: if s[i]=="o": dpr.append(i) count += 1 i += -c-1 els...
n, k, c = map(int, input().split()) s = input() dpl = [] dpr = [] ans = [] count = 0 i = 0 while count < k: if s[i]=="o": dpl.append(i) count += 1 i += c+1 else: i += 1 count = 0 i = n-1 while count < k: if s[i]=="o": dpr.append(i) count += 1 i += -c-1 els...
[["+", 0, 652, 3, 4, 0, 657, 31, 206, 51, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["+", 0, 652, 3, 4, 0, 657, 31, 206, 0, 73]]
5
164
N, K, C = map(int, input().split()) S = input() L = [0] * K i = 0 x = 0 while i<K and x<N: if S[x] == 'o': L[i] = x i += 1 x += C else: x += 1 R = [0] * K i = K-1 x = N-1 while i>=0 and x>=0: if S[x] == 'o': R[i] = x i -= 1 x -= C else: x...
N, K, C = map(int, input().split()) S = input() L = [0] * K i = 0 x = 0 while i<K and x<N: if S[x] == 'o': L[i] = x i += 1 x += C+1 else: x += 1 R = [0] * K i = K-1 x = N-1 while i>=0 and x>=0: if S[x] == 'o': R[i] = x i -= 1 x -= C+1 else: ...
[["+", 64, 196, 0, 1, 0, 677, 12, 657, 17, 72], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 12, 612]]
5
168
#include <algorithm> #include <array> #include <atomic> #include <bitset> #include <cassert> #include <ccomplex> #include <cctype> #include <cerrno> #include <cfenv> #include <cfloat> #include <chrono> #include <cinttypes> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <codecvt> #inc...
#include <algorithm> #include <array> #include <atomic> #include <bitset> #include <cassert> #include <ccomplex> #include <cctype> #include <cerrno> #include <cfenv> #include <cfloat> #include <chrono> #include <cinttypes> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <codecvt> #inc...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
594
#include "bits/stdc++.h" #define FI first.first #define SE first.second #define TH second #define fi first #define se second #define th second using namespace std; class DebugStream { } LOG; template <typename T> DebugStream &operator<<(DebugStream &s, const T &) { return s; } #ifdef DEBUG #define LOG clog #endif ...
#include "bits/stdc++.h" #define FI first.first #define SE first.second #define TH second #define fi first #define se second #define th second using namespace std; class DebugStream { } LOG; template <typename T> DebugStream &operator<<(DebugStream &s, const T &) { return s; } #ifdef DEBUG #define LOG clog #endif ...
[["-", 3, 4, 0, 16, 31, 16, 31, 69, 28, 22], ["-", 0, 16, 31, 16, 31, 69, 341, 342, 0, 70], ["-", 0, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["-", 0, 16, 31, 16, 31, 69, 341, 342, 0, 73], ["+", 28, 2, 3, 4, 0, 16, 31, 16, 31, 22]]
1
536
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define pb push_back using ll = long long; using P = pair<int, int>; using Graph = vector<vector<int>>; int n, k, c; vector<int> sub(string s) { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define pb push_back using ll = long long; using P = pair<int, int>; using Graph = vector<vector<int>>; int n, k, c; vector<int> sub(string s) { ...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
266
/* #pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") */ #pragma GCC optimize("O3") #pragma GCC target("sse4") #define NDEBUG #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstring>...
/* #pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") */ #pragma GCC optimize("O3") #pragma GCC target("sse4") #define NDEBUG #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstring>...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 1, 0, 11, 12, 16, 31, 69, 28, 22], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 70], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 73], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", ...
1
454
data = input().split(" ") N, K, C = int(data[0]), int(data[1]), int(data[2]) S = input() point = 0 work_start = [0] * (K + 1) for i in range(1, K + 1): point = S.find("o", point, N) work_start[i] = point + 1 point += C point = N work_end = [0] * (K + 1) for i in range(K, 0, -1): point = S.rfind("o", 0, point)...
data = input().split(" ") N, K, C = int(data[0]), int(data[1]), int(data[2]) S = input() point = 0 work_start = [0] * (K + 1) for i in range(1, K + 1): point = S.find("o", point, N) work_start[i] = point + 1 point += (C + 1) point = N work_end = [0] * (K + 1) for i in range(K, 0, -1): point = S.rfind("o", 0, ...
[["+", 8, 196, 0, 1, 0, 677, 12, 23, 0, 24], ["+", 0, 1, 0, 677, 12, 23, 0, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 23, 0, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 23, 0, 25]]
5
179
#include <bits/stdc++.h> using namespace std; const int inf = 1000000; int n, k, c; string s; int main() { cin >> n >> k >> c >> s; vector<int> g1, g2; { int lst = -inf; int p = 0; for (int i = 0; i < n && p < k; ++i) { if (s[i] == 'o' && i > lst + c) { g1[p++] = i; lst = i; ...
#include <bits/stdc++.h> using namespace std; const int inf = 1000000; int n, k, c; string s; int main() { cin >> n >> k >> c >> s; vector<int> g1(k), g2(k); { int lst = -inf; int p = 0; for (int i = 0; i < n && p < k; ++i) { if (s[i] == 'o' && i > lst + c) { g1[p++] = i; lst = i...
[["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
223
N, K, C = map(int,input().split()) S = list(input()) def solve(List): ans = [] i = 0 while i < N: if List[i] == 'o': ans.append(i+1) i += C i += 1 return ans n = solve(S) if len(n) > K: pass else: r = solve(S[::-1]) r = list(map(lambda x: N+1-x, r[:...
N, K, C = map(int,input().split()) S = list(input()) def solve(List): ans = [] i = 0 while i < N: if List[i] == 'o': ans.append(i+1) i += C i += 1 return ans n = solve(S) if len(n) > K: pass else: r = solve(S[::-1]) r = list(map(lambda x: N+1-x, r[:...
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
146
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int C = sc.nextInt(); String str = sc.next(); boolean[] can_work = new boolean[N]; for (int i = 0; i < N; i++) { if (str....
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int C = sc.nextInt(); String str = sc.next(); boolean[] can_work = new boolean[N]; for (int i = 0; i < N; i++) { if (str....
[["+", 0, 16, 12, 504, 71, 16, 31, 16, 31, 22], ["+", 0, 16, 12, 504, 71, 16, 31, 16, 17, 33], ["+", 0, 16, 12, 504, 71, 16, 31, 16, 12, 499], ["+", 15, 15, 0, 16, 12, 504, 71, 16, 17, 33]]
3
280
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, k, c...
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, k, c...
[["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
245
#include <iostream> #include <limits> #include <map> #include <set> #include <sstream> #include <vector> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<pair<int, int>> vii; typedef stringstream ss; const int mii = numeric_limits<int>::min(); const int mai ...
#include <iostream> #include <limits> #include <map> #include <set> #include <sstream> #include <vector> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<pair<int, int>> vii; typedef stringstream ss; const int mii = numeric_limits<int>::min(); const int mai ...
[["-", 0, 2, 3, 4, 0, 16, 12, 16, 17, 47], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 20]]
1
350
#include <bits/stdc++.h> using namespace std; using ll = long long; using vin = vector<int>; using vll = vector<long long>; using vvin = vector<vector<int>>; using vvll = vector<vector<long long>>; using vstr = vector<string>; using vvstr = vector<vector<string>>; using vch = vector<char>; using vvch = vector<vector<ch...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vin = vector<int>; using vll = vector<long long>; using vvin = vector<vector<int>>; using vvll = vector<vector<long long>>; using vstr = vector<string>; using vvstr = vector<vector<string>>; using vch = vector<char>; using vvch = vector<vector<ch...
[["-", 15, 339, 51, 16, 12, 16, 31, 16, 12, 13], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 13], ["-", 51, 16, 12, 16, 12, 16, 31, 69, 28, 22], ["+", 51, 16, 12, 16, 12, 16, 31, 69, 28, 22]]
1
685
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cassert> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <tuple> #include <vector> using namespace std; #define rep(i,...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cassert> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <tuple> #include <vector> using namespace std; #define rep(i,...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
345
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <chrono> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #inclu...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <chrono> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #inclu...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
2,153
def main(): n, k, c = (int(i) for i in input().split()) s = input() if k > sum(1 for c in s if c == 'o'): return latest = [None] * k earliest = [None] * k earliest[0] = s.index('o') for i in range(1, k): try: earliest[i] = s.index('o', earliest[i-1] + c + 1) ...
def main(): n, k, c = (int(i) for i in input().split()) s = input() if k > sum(1 for c in s if c == 'o'): return latest = [None] * k earliest = [None] * k earliest[0] = s.index('o') for i in range(1, k): try: earliest[i] = s.index('o', earliest[i-1] + c + 1) ...
[["-", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
230
#include <bits/stdc++.h> using namespace std; int main() { int n, k, c; vector<int> a, b; cin >> n >> k >> c; string s; cin >> s; for (int i = 0; i < n; i++) if (s[i] == 'o') { a.push_back(i); i += c; }; for (int i = n - 1; i > 0; i--) if (s[i] == 'o') { b.push_back(i); ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, c; vector<int> a, b; cin >> n >> k >> c; string s; cin >> s; for (int i = 0; i < n; i++) if (s[i] == 'o') { a.push_back(i); i += c; }; for (int i = n - 1; i >= 0; i--) if (s[i] == 'o') { b.push_back(i); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 20]]
1
171
# E - Yutori N,K,C = map(int,input().split()) S = input() L = [0]*K R = [0]*K i = 0 for j in range(K): while S[i]!='o': i += 1 L[j] = i i += C+1 i = K-1 for j in range(K-1,-1,-1): while S[i]!='o': i -= 1 R[j] = i i -= C+1 for j in range(K): if L[j]==R[j]: print...
# E - Yutori N,K,C = map(int,input().split()) S = input() L = [0]*K R = [0]*K i = 0 for j in range(K): while S[i]!='o': i += 1 L[j] = i i += C+1 i = N-1 for j in range(K-1,-1,-1): while S[i]!='o': i -= 1 R[j] = i i -= C+1 for j in range(K): if L[j]==R[j]: print...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
144
N,K,C = map(int,input().split()) S = input() L = [] R = [] i = 0 while i < N: if S[i] == "o": L.append(i) i += C i += 1 j = N-1 while j >= 0: if S[j] == "o": R.append(j) j -= C j -= 1 for i in range(K): if L[i] == R[K-1-i]: print(L[i]+1) exit() ...
N,K,C = map(int,input().split()) S = input() L = [] R = [] i = 0 while i < N: if S[i] == "o": L.append(i) i += C i += 1 j = N-1 while j >= 0: if S[j] == "o": R.append(j) j -= C j -= 1 for i in range(K): if L[i] == R[K-1-i]: print(L[i]+1)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
128
#include <bits/stdc++.h> using namespace std; #define MOD (long long int)(1e9 + 7) #define ll long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define REP(i, n) for (int i = n - 1; i >= 0; i--) #define REPS(i, n) for (int i = n; i > 0; i--) #defin...
#include <bits/stdc++.h> using namespace std; #define MOD (long long int)(1e9 + 7) #define ll long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define REP(i, n) for (int i = n - 1; i >= 0; i--) #define REPS(i, n) for (int i = n; i > 0; i--) #defin...
[["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 33], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95]]
1
411
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define INF 0x3f3f3f3f const int N = 2e5 + 5; const ll mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL); int n, k, c; string s; cin >> n >> k >> c >> s; vector<int> l(k), r(k); ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define INF 0x3f3f3f3f const int N = 2e5 + 5; const ll mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL); int n, k, c; string s; cin >> n >> k >> c >> s; vector<int> l(k), r(k); ...
[["+", 31, 69, 341, 342, 0, 16, 31, 16, 31, 22], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
215
#include <iostream> #include <vector> using namespace std; int main() { int n, k, c; string s; cin >> n >> k >> c >> s; int *l = new int[k]; int *r = new int[k]; for (int i = 0, ki = 0; i < n; i++) { if (s[i] == 'o') { l[ki++] = i; i += c; if (ki == k) break; } } for (i...
#include <iostream> #include <vector> using namespace std; int main() { int n, k, c; string s; cin >> n >> k >> c >> s; int *l = new int[k]; int *r = new int[k]; for (int i = 0, ki = 0; i < n; i++) { if (s[i] == 'o') { l[ki++] = i; i += c; if (ki == k) break; } } for (i...
[["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22]]
1
206
#include <bits/stdc++.h> using namespace std; template <typename T> void debug(string t, T input) { cout << t << "-> " << input << "\n"; } template <typename T> void debug(int i, string t, T input) { cout << "Case#" << i << " " << t << "-> " << input << "\n"; } int main() { ios::sync_with_stdio(0); cin.tie(0)...
#include <bits/stdc++.h> using namespace std; template <typename T> void debug(string t, T input) { cout << t << "-> " << input << "\n"; } template <typename T> void debug(int i, string t, T input) { cout << "Case#" << i << " " << t << "-> " << input << "\n"; } int main() { ios::sync_with_stdio(0); cin.tie(0)...
[["+", 12, 69, 341, 342, 0, 16, 31, 16, 31, 22], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 17, 33], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
268
#include <bits/stdc++.h> //#define DEBUG #ifdef DEBUG using std::endl; std::ifstream cin("input.txt"); std::ofstream cout("output.txt"); #endif // DEBUG #ifndef DEBUG using namespace std; #endif // DEBUG template <class T> void print_vect(std::vector<T> v) { for (int i = 0; i < v.size(); i++) cout << v[i] << "...
#include <bits/stdc++.h> //#define DEBUG #ifdef DEBUG using std::endl; std::ifstream cin("input.txt"); std::ofstream cout("output.txt"); #endif // DEBUG #ifndef DEBUG using namespace std; #endif // DEBUG template <class T> void print_vect(std::vector<T> v) { for (int i = 0; i < v.size(); i++) cout << v[i] << "...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22]]
1
417
n,k,c=[int(x) for x in input().split()] s=list(input()) L=[] R=[] i=0 while i < n: if s[i]=="o": L.append(i) i+=2 i+=1 i=0 while i < n: if s[n-i-1]=="o": R.append(n-i-1) i+=2 i+=1 days=[] for i in range(k): if L[i]==R[i]: days.append(L[i]) for i in ran...
n,k,c=[int(x) for x in input().split()] s=list(input()) L=[] R=[] i=0 while i < n: if s[i]=="o": L.append(i) i+=c i+=1 i=0 while i < n: if s[n-i-1]=="o": R.append(n-i-1) i+=c i+=1 days=[] for i in range(k): if L[i]==R[k-i-1]: days.append(L[i]) for ...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 15, 666, 0, 206, 206, 657, 31, 657, 31, 22], ["+", 15, 666, 0, 206, 206, 657, 31, 657, 17, 33], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 17, 33], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 12, 612]]
5
158
#include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #includ...
#include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #includ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
1,333
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, k, c; cin >> n >> k >> c; char s[n]; bool schedule[n]; int lower[k], upper[k]; rep(i, n) { cin >> s[i]; schedule[i] = s[i] == 'o'; } int j = 0, index = 0; while (j < n && index < k) { ...
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, k, c; cin >> n >> k >> c; char s[n]; bool schedule[n]; int lower[k], upper[k]; rep(i, n) { cin >> s[i]; schedule[i] = s[i] == 'o'; } int j = 0, index = 0; while (j < n && index < k) { ...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 20]]
1
219
#include <iostream> using namespace std; int n, k, c, l[200005], r[200005]; string s; int main() { cin >> n >> k >> c; cin >> s; int pre = -c - 1, idx = 0; for (int i = 0; i < n; i++) { if (s[i] == 'o' && i - pre > c) { pre = i; l[idx] = i; idx++; if (idx == k) break; }...
#include <iostream> using namespace std; int n, k, c, l[200005], r[200005]; string s; int main() { cin >> n >> k >> c; cin >> s; int pre = -c - 1, idx = 0; for (int i = 0; i < n; i++) { if (s[i] == 'o' && i - pre > c) { pre = i; l[idx] = i; idx++; if (idx == k) break; }...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
223
#入力受け取り N, K, C=map(int, input().split()) S='x'+input() #インデックスと日数を合わせるために先頭に'x'を追加 #前詰めな働き方の場合で働く日を求める A=[] #前詰めで働く場合の働く日リスト i=1 #1日目から判定スタート while len(A)<K: if S[i]=='o': #i日目に働けるなら、リストにiを追加し、iをC+1だけ進める A.append(i+1) i+=(C+1) else: #i日目に働けないならその日は働けないので(小泉構文)、iに1足すのみ i+=1 #後ろ詰めな働き方の場合で働く...
#入力受け取り N, K, C=map(int, input().split()) S='x'+input() #インデックスと日数を合わせるために先頭に'x'を追加 #前詰めな働き方の場合で働く日を求める A=[] #前詰めで働く場合の働く日リスト i=1 #1日目から判定スタート while len(A)<K: if S[i]=='o': #i日目に働けるなら、リストにiを追加し、iをC+1だけ進める A.append(i) i+=(C+1) else: #i日目に働けないならその日は働けないので(小泉構文)、iに1足すのみ i+=1 #後ろ詰めな働き方の場合で働く日を...
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
163
// She is Pretty pretty! #include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define mp make_pair #define pb push_back const int N = 1e6 + 100; int n, k, c; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k >> c >> s; ...
// She is Pretty pretty! #include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define mp make_pair #define pb push_back const int N = 1e6 + 100; int n, k, c; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k >> c >> s; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 73]]
1
250
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from bisect import bisect_right, bisect_left import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factori...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from bisect import bisect_right, bisect_left import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factori...
[["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 47]]
5
483
def solve(): N, K, C = map(int, input().split()) workable = [i for i, s in enumerate(input(), 1) if s=="o"] if len(workable) == K: yield from workable latest = set() prev = workable[-1]+C+1 for x in reversed(workable): if prev - x > C: latest.add(x) prev = x if len(latest) > K:...
def solve(): N, K, C = map(int, input().split()) workable = [i for i, s in enumerate(input(), 1) if s=="o"] if len(workable) == K: yield from workable return latest = set() prev = workable[-1]+C+1 for x in reversed(workable): if prev - x > C: latest.add(x) prev = x if len(...
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]]
5
153
def solve(): N, K, C = map(int, input().split()) workable = [i for i, s in enumerate(input()) if s=="o"] if len(workable) == K: return workable latest = set() prev = workable[-1]+C+1 for x in reversed(workable): if prev - x > C: latest.add(x) prev = x if len(latest) > K: ...
def solve(): N, K, C = map(int, input().split()) workable = [i for i, s in enumerate(input(), 1) if s=="o"] if len(workable) == K: return workable latest = set() prev = workable[-1]+C+1 for x in reversed(workable): if prev - x > C: latest.add(x) prev = x if len(latest) > K: ...
[["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 21], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
162
# -*- coding: utf-8 -*- """ Created on Sun Apr 5 22:11:18 2020 @author: Kanaru Sato """ n,k,c = list(map(int, input().split())) s = list(input()) early = [] late = [] i = 0 count = 0 while i < n and count < k: if s[i] == "o": early.append(i) i = i+c+1 count = count+1 else: i...
# -*- coding: utf-8 -*- """ Created on Sun Apr 5 22:11:18 2020 @author: Kanaru Sato """ n,k,c = list(map(int, input().split())) s = list(input()) early = [] late = [] i = 0 count = 0 while i < n and count < k: if s[i] == "o": early.append(i) i = i+c+1 count = count+1 else: i...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
183
n,k,c=map(int,input().split()) s=list(input()) for i in range(len(s)): if s[i]=="o": s[i]=True else: s[i]=False i=0 work1=[] while len(work1)<k: if s[i]: work1.append(i) i+=c+1 else: i+=1 i=n-1 work2=[] while len(work2)<k: if s[i]: work2.append(i) i-=c+1 else: i-=1 for i in range(k): if work1[i]=...
n,k,c=map(int,input().split()) s=list(input()) for i in range(len(s)): if s[i]=="o": s[i]=True else: s[i]=False i=0 work1=[] while len(work1)<k: if s[i]: work1.append(i) i+=c+1 else: i+=1 i=n-1 work2=[] while len(work2)<k: if s[i]: work2.append(i) i-=c+1 else: i-=1 work2.sort() for i in range(k): ...
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
165
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define all(vec) vec.begin(), vec.end() int main() { int n, k, c; string s; cin >> n >> k >> c >> s; vector<int> a; rep(i, n) { if (s.at(i) == 'o') { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define all(vec) vec.begin(), vec.end() int main() { int n, k, c; string s; cin >> n >> k >> c >> s; vector<int> a; rep(i, n) { if (s.at(i) == 'o') { ...
[["+", 64, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
190
N,K,C = map(int,input().split()) S = input() L = [] R = [] i = 0 while i < N: if S[i] == "o": L.append(i) if len(L) == K: break i += C else: i += 1 i = N-1 while i >= 0: if S[i] == "o": R.append(i) if len(R) == K: break i -= C ...
N,K,C = map(int,input().split()) S = input() L = [] R = [] i = 0 while i < N: if S[i] == "o": L.append(i) if len(L) == K: break i += C+1 else: i += 1 i = N-1 while i >= 0: if S[i] == "o": R.append(i) if len(R) == K: break i -= C...
[["+", 64, 196, 0, 1, 0, 677, 12, 657, 17, 72], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 12, 612]]
5
148
#include <bits/stdc++.h> #define _LIBCPP_DEBUG 0 using namespace std; typedef long long int ll; ll MOD = 1e9 + 7; int INF = 1 << 30; int main(void) { int N, K, C; cin >> N >> K >> C; string S; cin >> S; vector<int> SMAP(N, 0); vector<int> SMAP2(N, 0); int cnt = K; for (int i = N - 1; i >= 0; i--) { ...
#include <bits/stdc++.h> #define _LIBCPP_DEBUG 0 using namespace std; typedef long long int ll; ll MOD = 1e9 + 7; int INF = 1 << 30; int main(void) { int N, K, C; cin >> N >> K >> C; string S; cin >> S; vector<int> SMAP(N, 0); vector<int> SMAP2(N, 0); int cnt = K; for (int i = N - 1; i >= 0; i--) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
216
#include <bits/stdc++.h> using namespace std; int main() { int n, k, c; cin >> n >> k >> c; string s; cin >> s; int a[k] = {}, b[k] = {}; for (int i = 0, j = 0; i < n && j < k; i++) { if (s[i] == 'o') a[j++] = i + 1, i += c; } for (int i = n - 1, j = k - 1; i >= 0 && j >= 0; i--) { if (s[...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, c; cin >> n >> k >> c; string s; cin >> s; int a[k] = {}, b[k] = {}; for (int i = 0, j = 0; i < n && j < k; i++) { if (s[i] == 'o') a[j++] = i + 1, i += c; } for (int i = n - 1, j = k - 1; i >= 0 && j >= 0; i--) { if (s[...
[["+", 64, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 73]]
1
200
n,k,c = map(int,input().split()) S = input() left = [ -1 for i in range(k)] right = [ -1 for i in range(k)] pointer = 0 for l in range(k): for s in range(pointer,n): if S[s] == 'o': left[l] = s pointer = s+c break pointer = n-1 for r in range(k): for s in range(pointer,0,-1): if S[s] ...
n,k,c = map(int,input().split()) S = input() left = [ -1 for i in range(k)] right = [ -1 for i in range(k)] pointer = 0 for l in range(k): for s in range(pointer,n): if S[s] == 'o': left[l] = s pointer = s+c+1 break pointer = n-1 for r in range(k): for s in range(pointer,-1,-1): if S...
[["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33]]
5
169
N,K,C=map(int,input().split()) S=input() L=[0 for i in range(K)] R=[0 for i in range(K)] n=0 rc=0 lc=0 while True: if lc==K: break if S[n]=="o": L[lc]=n+1 n+=C+1 lc+=1 else: n+=1 n=N-1 while True: if rc==K: break if S[n]=="o": R[N-1-rc]=n+1 n-=C+1 rc+=1 else: n-=1 for...
N,K,C=map(int,input().split()) S=input() L=[0 for i in range(K)] R=[0 for i in range(K)] n=0 rc=0 lc=0 while True: if lc==K: break if S[n]=="o": L[lc]=n+1 n+=C+1 lc+=1 else: n+=1 n=N-1 while True: if rc==K: break if S[n]=="o": R[K-1-rc]=n+1 n-=C+1 rc+=1 else: n-=1 for...
[["-", 0, 662, 31, 206, 206, 657, 31, 657, 31, 22], ["+", 0, 662, 31, 206, 206, 657, 31, 657, 31, 22]]
5
171
N, K, C = map(int, input().split()) S = input() Sr = "".join(list(reversed(S))) wd = [] wdl = [] pw = 0 pwl = 0 for d in range(K): # 先詰めを探す while True: if S[pw] == ('o'): wd.append(pw) break pw += 1 pw += C + 1 # 後詰めを探す while True: if Sr[pwl]...
N, K, C = map(int, input().split()) S = input() Sr = "".join(list(reversed(S))) wd = [] wdl = [] pw = 0 pwl = 0 for d in range(K): # 先詰めを探す while True: if S[pw] == ('o'): wd.append(pw) break pw += 1 pw += C + 1 # 後詰めを探す while True: if Sr[pwl]...
[["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 31, 22], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
155
#include <stdio.h> #define maxn 200010 int L[maxn], R[maxn], lc, rc; char s[maxn]; int main() { int n, k, c, i; scanf("%d%d%d%s", &n, &k, &c, s + 1); for (i = 1; i <= n;) { //正向寻找 if (s[i] == 'o') { L[++lc] = i, i += c; if (lc == k) break; } i++; } for (i = n; i >= 1;) { //反向寻找...
#include <stdio.h> #define maxn 200010 int L[maxn], R[maxn], lc, rc; char s[maxn]; int main() { int n, k, c, i; scanf("%d%d%d%s", &n, &k, &c, s + 1); for (i = 1; i <= n;) { //正向寻找 if (s[i] == 'o') { L[++lc] = i, i += c; if (lc == k) break; } i++; } for (i = n; i >= 1;) { //反向寻找...
[["+", 64, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
204
N, K, C = gets.split.map(&:to_i) S = gets.strip.chars.map { |char| char == 'o' ? 0 : nil } ss = S.size # Justify the numbers to the right dates_from_left = S # Justify the numbers to the left dates_from_right = S.reverse ans = [] i = 0 plan = 1 while i < N break if plan > K if dates_from_left[i] == 0 dates_fr...
N, K, C = gets.split.map(&:to_i) S = gets.strip.chars.map { |char| char == 'o' ? 0 : nil } ss = S.size # Justify the numbers to the right dates_from_left = S # Justify the numbers to the left dates_from_right = S.reverse ans = [] i = 0 plan = 1 while i < N break if plan > K if dates_from_left[i] == 0 dates_fr...
[["-", 0, 751, 15, 738, 12, 742, 500, 652, 17, 131], ["-", 0, 751, 15, 738, 12, 742, 500, 652, 735, 22]]
4
198
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cout << setprecision(10) << fixed; int n, k, c; cin >> n >> k >> c; string s; cin >> s; vector<int> pre(n, 0), suff(n, 0); int j = 0, tmpk = 0; while (j < n) { if (s[j] == 'o') { pre[j] = ++tmpk; j += ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cout << setprecision(10) << fixed; int n, k, c; cin >> n >> k >> c; string s; cin >> s; vector<int> pre(n, 0), suff(n, 0); int j = 0, tmpk = 0; while (j < n) { if (s[j] == 'o') { pre[j] = ++tmpk; j += ...
[["+", 51, 16, 31, 16, 12, 16, 31, 16, 31, 22], ["+", 51, 16, 31, 16, 12, 16, 31, 16, 17, 33], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 72], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13]]
1
243
#include <bits/stdc++.h> using namespace std; int n, k, c; char s[200005]; set<int> st; set<int> st2; set<int> st3; int main() { // freopen("in.txt","r",stdin); scanf("%d%d%d%s", &n, &k, &c, s); int cnt = 1; for (int i = 0; i < n; i++) { if (s[i] == 'o') { st.insert(i + 1); cnt++; i += c;...
#include <bits/stdc++.h> using namespace std; int n, k, c; char s[200005]; set<int> st; set<int> st2; set<int> st3; int main() { // freopen("in.txt","r",stdin); scanf("%d%d%d%s", &n, &k, &c, s); int cnt = 0; for (int i = 0; i < n; i++) { if (s[i] == 'o') { st.insert(i + 1); cnt++; i += c;...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
223
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <utility> #include <vector> using namespace std; void show(vector<int> &s) { for (auto x : s) { cout << x << " "; } cout << endl; } int main() { int n, k, c; cin >> n >> k >> c; string s; cin >> s; vector<int>...
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <utility> #include <vector> using namespace std; void show(vector<int> &s) { for (auto x : s) { cout << x << " "; } cout << endl; } int main() { int n, k, c; cin >> n >> k >> c; string s; cin >> s; vector<int>...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 15, 16, 12, 2, 63, 118, 28, 22], ["+", 0, 7, 15, 16, 12, 2, 63, 118, 17, 131], ["+", 0, 7, 15, 16, 12, 2, 63, 118, 119, 120], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 25]]
1
340
#include <bits/stdc++.h> using namespace std; #define ll long long #define db double const int inf = 1 << 30; const ll linf = 1e18; template <class T> void chmin(T &x, T y) { if (x > y) x = y; } template <class T> void chmax(T &x, T y) { if (x < y) x = y; } bool flag[200010]; int b[200010]; int f[200010]; i...
#include <bits/stdc++.h> using namespace std; #define ll long long #define db double const int inf = 1 << 30; const ll linf = 1e18; template <class T> void chmin(T &x, T y) { if (x > y) x = y; } template <class T> void chmax(T &x, T y) { if (x < y) x = y; } bool flag[200010]; int b[200010]; int f[200010]; i...
[["+", 8, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 8, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
793
N,K,C = (int(i) for i in input().split()) S = str(input()) L = [-1] * K R = [-1] * K S_index = 0 count = 0 while count < K: if S[S_index] == "o": L[count] = S_index count += 1 S_index += C+1 else: S_index += 1 S_index = N-1 count = 0 while count < K: if S[S_index] == "o": R[count] = S_index ...
N,K,C = (int(i) for i in input().split()) S = str(input()) L = [-1] * K R = [-1] * K S_index = 0 count = 0 while count < K: if S[S_index] == "o": L[count] = S_index count += 1 S_index += C+1 else: S_index += 1 S_index = N-1 count = 0 while count < K: if S[S_index] == "o": R[count] = S_index ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
155
N,K,C= map(int,input().split()) S = input() T = [n for n, v in enumerate(S) if v == "o"] a,b=[T[0]],[T[-1]] for i in range(len(T)): if len(a)!=K: if T[i]-a[-1]>C: a.append(T[i]) if len(b)!=K: if b[0]-T[-i-1]>C: b.append(T[-i-1]) for i in range(K): if a[i]==b[-i-1]: print(a[i]+1) ...
N,K,C= map(int,input().split()) S = input() T = [n for n, v in enumerate(S) if v == "o"] a,b=[T[0]],[T[-1]] for i in range(len(T)): if len(a)!=K: if T[i]-a[-1]>C: a.append(T[i]) if len(b)!=K: if b[-1]-T[-i-1]>C: b.append(T[-i-1]) for i in range(K): if a[i]==b[-i-1]: print(a[i]+1) ...
[["-", 0, 57, 15, 666, 0, 657, 31, 206, 206, 612], ["+", 15, 666, 0, 657, 31, 206, 206, 664, 17, 33], ["+", 15, 666, 0, 657, 31, 206, 206, 664, 28, 612]]
5
170
#!/usr/bin/env python3 import sys def solve(N: int, K: int, C: int, S: str): # 最善だったら何ケースか work = 0 rest = 0 startWork = -1 leftIndices = set() rightIndices = set() for i in range(N): if S[i] == "o" and rest <= 0: rest = C work += 1 leftIndices.a...
#!/usr/bin/env python3 import sys def solve(N: int, K: int, C: int, S: str): # 最善だったら何ケースか work = 0 rest = 0 startWork = -1 leftIndices = set() rightIndices = set() for i in range(N): if S[i] == "o" and rest <= 0: rest = C work += 1 leftIndices.a...
[["+", 0, 14, 8, 196, 0, 7, 12, 652, 63, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
277
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collection...
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collection...
[["-", 0, 656, 0, 7, 12, 652, 63, 319, 500, 22], ["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22...
5
242
#include <stdio.h> int main() { int n, k, c; int r[2 << 17]; scanf("%d %d %d", &n, &k, &c); char s[2 << 17]; gets(s); int p = k; for (int i = n; i-- > 0;) { if (s[i] == 'o') { r[i] = p--; i -= c; } } p = 0; for (int i = 0; i < n; i++) { if (s[i] == 'o') { if (r[i] == ++...
#include <stdio.h> int main() { int n, k, c; int r[2 << 17]; scanf("%d %d %d", &n, &k, &c); char s[2 << 17]; scanf("%s", s); int p = k; for (int i = n; i-- > 0;) { if (s[i] == 'o') { r[i] = p--; i -= c; } } p = 0; for (int i = 0; i < n; i++) { if (s[i] == 'o') { if (r[i...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21]]
0
159
k,y,c = map( int, input().split(" ")) ss = input() asc = [] dsc = [] cnt = 0 err_flg = 0 while( True ): if(len(ss) <= cnt): err_flg = 1 break if( ss[cnt] == "o"): asc.append( cnt ) cnt += c+1 else: cnt += 1 if( len(asc)==y ): break cnt = 0 ss = ss[::-1] while( True ): if(len(ss...
k,y,c = map( int, input().split(" ")) ss = input() asc = [] dsc = [] cnt = 0 err_flg = 0 while( True ): if(len(ss) <= cnt): err_flg = 1 break if( ss[cnt] == "o"): asc.append( cnt ) cnt += c+1 else: cnt += 1 if( len(asc)==y ): break cnt = 0 ss = ss[::-1] while( True ): if(len(ss...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
240
import copy n,k,c = map(int,input().split()) s = list(input()) front = [] back = [] # 前から貪欲 j = copy.copy(k) i = 0 while j > 0: if s[i] == "o": front.append(i) i += c+1 j -= 1 else: i += 1 # 後ろから貪欲 j = copy.copy(k) i = n-1 while j > 0: if s[i] == "o": back.append(i) i -= c+1 ...
import copy n,k,c = map(int,input().split()) s = list(input()) front = [] back = [] # 前から貪欲 j = copy.copy(k) i = 0 while j > 0: if s[i] == "o": front.append(i) i += c+1 j -= 1 else: i += 1 # 後ろから貪欲 j = copy.copy(k) i = n-1 while j > 0: if s[i] == "o": back.append(i) i -= c+1 ...
[["+", 0, 652, 3, 4, 0, 657, 31, 206, 51, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["+", 0, 652, 3, 4, 0, 657, 31, 206, 0, 73]]
5
160
int N, K, C; char S[2 << 17]; int R[2 << 17]; main() { scanf("%d%d%d\n", &N, &K, &C); gets(S); int now = K; for (int i = N; i-- > 0;) { if (S[i] == 'o') { R[i] = now--; i -= C; } } now = 0; for (int i = 0; i < N; i++) { if (S[i] == 'o') { if (R[i] == ++now) printf("%d...
int N, K, C; char S[2 << 17]; int R[2 << 17]; main() { scanf("%d%d%d\n", &N, &K, &C); gets(S); int now = K; for (int i = N; i-- > 0;) { if (S[i] == 'o') { R[i] = now--; i -= C; } } now = 0; for (int i = 0; i < N; i++) { if (S[i] == 'o') { if (R[i] == ++now) printf("%d...
[["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
0
153
n,k,c=map(int,input().split()) s=input() l=len(s) cand=[] for i in range(l): if s[i]=='o': cand.append(i+1) cnt1=[0]*(n+2) cnt2=[0]*(n+2) prev=0 cnt=0 for i in range(l): if s[i]=='o' and i>=prev: cnt+=1 cnt1[i+1]=cnt prev=i+(c+1) else: cnt1[i+1]=cnt prev=l cnt=0 for i in range(l-1,-1,-1): if...
n,k,c=map(int,input().split()) s=input() l=len(s) cand=[] for i in range(l): if s[i]=='o': cand.append(i+1) cnt1=[0]*(n+2) cnt2=[0]*(n+2) prev=0 cnt=0 for i in range(l): if s[i]=='o' and i>=prev: cnt+=1 cnt1[i+1]=cnt prev=i+(c+1) else: cnt1[i+1]=cnt prev=l cnt=0 for i in range(l-1,-1,-1): if...
[["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
253
#include "algorithm" #include "cmath" #include "cstdio" #include "cstring" #include "iostream" #include "map" #include "queue" #include "set" #include "vector" using namespace std; #define MAXN 200006 //#define int long long #define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i) #define per(i, a, b) for...
#include "algorithm" #include "cmath" #include "cstdio" #include "cstring" #include "iostream" #include "map" #include "queue" #include "set" #include "vector" using namespace std; #define MAXN 200006 //#define int long long #define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i) #define per(i, a, b) for...
[["+", 0, 52, 8, 9, 0, 1, 0, 34, 0, 21], ["+", 8, 9, 0, 1, 0, 34, 12, 27, 17, 68], ["+", 8, 9, 0, 1, 0, 34, 12, 27, 28, 22]]
1
510
#include <bits/stdc++.h> #define ll long long #define clr(x, i) memset(x, i, sizeof(x)) using namespace std; const int N = 200005; const ll mod = 1e9 + 7; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch ...
#include <bits/stdc++.h> #define ll long long #define clr(x, i) memset(x, i, sizeof(x)) using namespace std; const int N = 200005; const ll mod = 1e9 + 7; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19]]
1
508
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; // vector string deque break continue #define forn(i, s, f) for (int i = (int)s; i < (int)f; i++) #define ll long long #define ull unsigned long long #define ld long double #define pii pair<int, int> #define fs first #define sc second #define...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; // vector string deque break continue #define forn(i, s, f) for (int i = (int)s; i < (int)f; i++) #define ll long long #define ull unsigned long long #define ld long double #define pii pair<int, int> #define fs first #define sc second #define...
[["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 44]]
1
754
n,k,c=gets.split.map &:to_i s=gets.chomp idxs=[] s.each_char.with_index{|c,i| idxs.push(i) if c==?o } cs=[0] t,nidx=0,n-1 idxs.reverse_each{|e| if e<=nidx cs.unshift(t+=1) nidx-=c+1 else cs.unshift(t) end } nidx=0 idxs.each_with_index{|e,i| next if e<nidx puts e+1 if cs[i]<=k && cs[i]>cs[i+1] ...
n,k,c=gets.split.map &:to_i s=gets.chomp idxs=[] s.each_char.with_index{|c,i| idxs.push(i) if c==?o } cs=[0] t,nidx=0,n-1 idxs.reverse_each{|e| if e<=nidx cs.unshift(t+=1) nidx=e-c-1 else cs.unshift(t) end } nidx=0 idxs.each_with_index{|e,i| next if e<nidx puts e+1 if cs[i]<=k && cs[i]>cs[i+1] ...
[["-", 8, 734, 0, 121, 64, 749, 0, 755, 17, 110], ["+", 8, 734, 0, 121, 64, 749, 0, 662, 0, 32], ["+", 64, 749, 0, 662, 12, 738, 31, 738, 31, 22], ["+", 64, 749, 0, 662, 12, 738, 31, 738, 17, 33], ["-", 0, 121, 64, 749, 0, 755, 12, 738, 17, 72], ["+", 0, 121, 64, 749, 0, 662, 12, 738, 17, 33]]
4
147
#include <bits/stdc++.h> #ifdef NON_SUBMIT #define TEST(n) (n) #define tout cerr #else #define TEST(n) ((void)0) #define tout cin #endif using namespace std; const int SZ = 1 << 18; int D[200000], D2[200000], tree[2 * SZ]; int get_max(int s, int e) { int ret = 0; for (s += SZ, e += SZ; s <= e; s >>= 1, e >>= 1)...
#include <bits/stdc++.h> #ifdef NON_SUBMIT #define TEST(n) (n) #define tout cerr #else #define TEST(n) ((void)0) #define tout cin #endif using namespace std; const int SZ = 1 << 18; int D[200000], D2[200000], tree[2 * SZ]; int get_max(int s, int e) { int ret = 0; for (s += SZ, e += SZ; s <= e; s >>= 1, e >>= 1)...
[["-", 0, 16, 31, 23, 0, 41, 64, 69, 28, 22], ["+", 0, 16, 31, 23, 0, 41, 64, 69, 28, 22], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13]]
1
565
n,k,c = map(int,input().split()) s = input() frt = [0]*n bck = [0]*n cnt = 0 cntb = 0 prv = 0 prvb = 0 st = set() stb = set() for i in range(n): if cnt == 0 and s[i] == "o": cnt += 1 frt[i] = 1 prv = i st.add(i) elif i-prv > c and s[i] == "o": cnt += 1 frt[i] = cnt prv = i st.add(i) ...
n,k,c = map(int,input().split()) s = input() frt = [0]*n bck = [0]*n cnt = 0 cntb = 0 prv = 0 prvb = 0 st = set() stb = set() for i in range(n): if cnt == 0 and s[i] == "o": cnt += 1 frt[i] = 1 prv = i st.add(i) elif i-prv > c and s[i] == "o": cnt += 1 frt[i] = cnt prv = i st.add(i) ...
[["-", 75, 665, 15, 679, 31, 666, 0, 657, 31, 22], ["+", 75, 665, 15, 679, 31, 666, 0, 657, 31, 22], ["-", 75, 665, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 31, 22]]
5
261
n,k,c = map(int,input().split()) sl = list(input()) # 前貪欲 ansl = [] before = -float("inf") for idx,s in enumerate(sl): if s == "o" and before + c < idx: before = idx ansl.append(idx) if len(ansl) > k: print() exit() # 後貪欲 ansl2 = [] before = -float("inf") for idx,s in enumerate(sl[::-1]): ...
n,k,c = map(int,input().split()) sl = list(input()) # 前貪欲 ansl = [] before = -float("inf") for idx,s in enumerate(sl): if s == "o" and before + c < idx: before = idx ansl.append(idx) if len(ansl) > k: print() exit() # 後貪欲 ansl2 = [] before = -float("inf") for idx,s in enumerate(sl[::-1]): ...
[["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25]]
5
164
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 2e5 + 10; const int INF = 0x3f3f3f3f; int n, k, c; char s[N]; int L[N], R[N]; int main() { scanf("%d%d%d", &n, &k, &c); scanf("%s", s + 1); int cur = 1, d = 0; while (cur <= n) { if (s[cur] == 'o') { L[++d] = cur; c...
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 2e5 + 10; const int INF = 0x3f3f3f3f; int n, k, c; char s[N]; int L[N], R[N]; int main() { scanf("%d%d%d", &n, &k, &c); scanf("%s", s + 1); int cur = 1, d = 0; while (cur <= n) { if (s[cur] == 'o') { L[++d] = cur; c...
[["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22]]
1
239
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; int main() { int n, k, c; string s; cin >> n >> k >> c >> s; vector<int> P, Q, ans; for (int i = 0; i < n; i++) { if (s[i] == 'o') { P.push_back(i + 1); i += c; } } revers...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; int main() { int n, k, c; string s; cin >> n >> k >> c >> s; vector<int> P, Q, ans; for (int i = 0; i < n; i++) { if (s[i] == 'o') { P.push_back(i + 1); i += c; } } revers...
[["-", 0, 9, 0, 52, 15, 339, 51, 16, 17, 106], ["+", 0, 9, 0, 52, 15, 339, 51, 16, 17, 98]]
1
308
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); int K = stdIn.nextInt(); int C = stdIn.nextInt(); String a = stdIn.next(); boolean work[] = new boolean[N]; int L[] = new...
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); int K = stdIn.nextInt(); int C = stdIn.nextInt(); String a = stdIn.next(); boolean work[] = new boolean[N]; int L[] = new...
[["-", 64, 196, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 64, 196, 0, 1, 0, 11, 12, 16, 12, 499]]
3
299
package main import ( "bufio" "fmt" "os" "strconv" ) var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout) func scanString() string { sc.Scan(); return sc.Text() } func scanRunes() []rune { return []rune(scanString()) } func scanInt() int { a, _ := strconv.Atoi(scanString()); return a ...
package main import ( "bufio" "fmt" "os" "strconv" ) var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout) func scanString() string { sc.Scan(); return sc.Text() } func scanRunes() []rune { return []rune(scanString()) } func scanInt() int { a, _ := strconv.Atoi(scanString()); return a ...
[["+", 31, 432, 0, 437, 71, 16, 31, 16, 31, 22], ["+", 31, 432, 0, 437, 71, 16, 31, 16, 17, 33], ["+", 31, 432, 0, 437, 71, 16, 31, 16, 12, 433], ["+", 0, 436, 31, 432, 0, 437, 71, 16, 17, 33]]
7
649
N, K, C = map(int,input().split()) S = list(input()) A = list() B = list() i = 0 num = 0 while num < K: if S[i] == "o": A.append(i) num += 1 i += 3 i += 1 i = len(S)-1 num = 0 while num < K: if S[i] == "o": B.append(i) num+=1 i -= 3 i -= 1 B.sort() for i,j in zip(A,B): if i == j: ...
N, K, C = map(int,input().split()) S = list(input()) A = list() B = list() i = 0 num = 0 while num < K: if S[i] == "o": A.append(i) num += 1 i += C i += 1 i = len(S)-1 num = 0 while num < K: if S[i] == "o": B.append(i) num+=1 i -= C i -= 1 B.sort() for i,j in zip(A,B): if i == j: ...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
141
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll MOD = 1e9 + 7; constexpr ll INF = 1e18; int main() { ll n, m, i, j, k, c; cin >> n >> k >> c; string s; cin >> s; ll L[k + 1] = {}, R[k + 1] = {}; ll cnt = 1; for (i = 0; i < n && cnt > k; i++) { if (s[i] == 'o') { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll MOD = 1e9 + 7; constexpr ll INF = 1e18; int main() { ll n, m, i, j, k, c; cin >> n >> k >> c; string s; cin >> s; ll L[k + 1] = {}, R[k + 1] = {}; ll cnt = 1; for (i = 0; i < n && cnt <= k; i++) { if (s[i] == 'o') { ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 47], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 19], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 20], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
229
def main(): n,k,c=map(int,input().split()) S=input() l1=[[0,0] for _ in range(n)] l2=[0]*n memo=[0]*n x=0 for i in range(n): if S[i]=="o" and memo[i]==0: x+=1 l1[i][0]=x l1[i][1]=i+c+1 for j in range(i,i+c+1): if j<n: ...
def main(): n,k,c=map(int,input().split()) S=input() l1=[[0,0] for _ in range(n)] l2=[0]*n memo=[0]*n x=0 for i in range(n): if S[i]=="o" and memo[i]==0: x+=1 l1[i][0]=x l1[i][1]=i+c+1 for j in range(i,i+c+1): if j<n: ...
[["+", 0, 57, 64, 196, 0, 57, 15, 679, 17, 355], ["+", 64, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 64, 196, 0, 57, 15, 679, 12, 666, 667, 79], ["+", 64, 196, 0, 57, 15, 679, 12, 666, 0, 612], ["-", 64, 196, 0, 1, 0, 677, 12, 206, 206, 612], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 206, 612]]
5
453
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i ...
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i ...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
635
n, k, c = map(int, input().split()) s = list(input()) l = [0 for _ in range(n + 1)] prev = -c for i in range(1, n + 1): l[i] = l[i - 1] if prev + c < i and s[i - 1] == 'o': l[i] += 1 prev = i r = [0 for _ in range(n + 1)] prev = n + c for i in range(n - 1, -1, -1): r[i] = r[i + 1] if i ...
n, k, c = map(int, input().split()) s = list(input()) l = [0 for _ in range(n + 1)] prev = -c for i in range(1, n + 1): l[i] = l[i - 1] if prev + c < i and s[i - 1] == 'o': l[i] += 1 prev = i r = [0 for _ in range(n + 1)] prev = n + c for i in range(n - 1, -1, -1): r[i] = r[i + 1] if i ...
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 12, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72]]
5
377
#include <algorithm> #include <cstdio> #include <iostream> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int n, k, c, a[200000]; string s; int mini[200000], maxi[200000]; int main() { cin >> n >> k >> c; cin >> s; maxi[0] = -1; set<pair<int, int>> sl, sr; for (int ...
#include <algorithm> #include <cstdio> #include <iostream> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int n, k, c, a[200000]; string s; int mini[200000], maxi[200000]; int main() { cin >> n >> k >> c; cin >> s; maxi[0] = -1; set<pair<int, int>> sl, sr; for (int ...
[["-", 8, 9, 0, 52, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60]]
1
471
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define rep(i, n) \ ; \ for (long long i = 0; i < (n); i++) using ll = long long; using P = pair<long long, long lon...
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define rep(i, n) \ ; \ for (long long i = 0; i < (n); i++) using ll = long long; using P = pair<long long, long lon...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
255
N = int(input()) ans = set() def check(N, k): if k<2: return False N //= k while N: if (N-1)%k==0: return True if N%k: return False N //= k for k in range(1, int(N**0.5)+1): if (N-1)%k==0: ans.add(k) ans.add((N-1)//k) if N%k==...
N = int(input()) ans = set() def check(N, k): if k<2: return False N //= k while N: if (N-1)%k==0: return True if N%k: return False N //= k for k in range(1, int(N**0.5)+1): if (N-1)%k==0: ans.add(k) ans.add((N-1)//k) if N%k==...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 676], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
153
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math import bisect from collections import deque from math import gcd from functools import lru_cache ############# # Constants # ############# MOD = 10**9+7 INF = float('inf') ############# # Functions...
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math import bisect from collections import deque from math import gcd from functools import lru_cache ############# # Constants # ############# MOD = 10**9+7 INF = float('inf') ############# # Functions...
[["-", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
824
#include <bits/stdc++.h> using namespace std; int main() { long long int N, ans = 0; cin >> N; for (long long int i = 2; i * i <= N; i++) { if (N % i == 0) { long long int other = N / i; long long int tmp = N; while (tmp % i == 0) { tmp /= i; } if (tmp % i == 1) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long int N, ans = 0; cin >> N; for (long long int i = 2; i * i <= N; i++) { if (N % i == 0) { long long int other = N / i; long long int tmp = N; while (tmp % i == 0) { tmp /= i; } if (tmp % i == 1) { ...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["-", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
226
def check(n, i): while n >= i and n % i == 0: n //= i return n % i == 1 def main(): N = int(input()) i = 2 r = set() while i * i <= N: if N % i == 0: if check(N, i): r.add(i) if check(N, N // i): r.add(N // i) elif ...
def check(n, i): while n >= i and n % i == 0: n //= i return n % i == 1 def main(): N = int(input()) i = 2 r = set() while i * i <= N: if N % i == 0: if check(N, i): r.add(i) if check(N, N // i): r.add(N // i) elif ...
[["+", 0, 656, 0, 14, 8, 196, 0, 57, 0, 121], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 656, 0, 14, 8, 196, 0, 57, 0, 102]]
5
154
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ll long long #define REP(i, a, b) for (ll i = a; i < b; i++) #define REPI(i, a, b) for (ll i = b - 1; i >= a; i--) #define i_os ...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ll long long #define REP(i, a, b) for (ll i = a; i < b; i++) #define REPI(i, a, b) for (ll i = b - 1; i >= a; i--) #define i_os ...
[["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
342
require 'prime' n = gets.to_i ans = (n-1).prime_division.inject(1){|r, (_, v)| r * (v + 1)} - 1 n.prime_division.map do |k, v| Array.new(v+1) {|i| k ** i} end.inject(:product).map{|e| e.flatten.inject(:*)}.drop(1).each do |x| y = n y /= x while y % x == 0 ans += 1 if y % x == 1 end puts ans
require 'prime' n = gets.to_i ans = (n-1).prime_division.inject(1){|r, (_, v)| r * (v + 1)} - 1 n.prime_division.map do |k, v| Array.new(v+1) {|i| k ** i} end.inject([1], :product).map{|e| e.flatten.inject(:*)}.drop(1).each do |x| y = n y /= x while y % x == 0 ans += 1 if y % x == 1 end puts ans
[["+", 486, 652, 486, 652, 3, 4, 0, 516, 0, 70], ["+", 486, 652, 486, 652, 3, 4, 0, 516, 0, 612], ["+", 486, 652, 486, 652, 3, 4, 0, 516, 0, 73], ["+", 486, 652, 486, 652, 486, 652, 3, 4, 0, 21]]
4
126
#include <bits/stdc++.h> #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; using i64 = int64_t; using f80 = __float80; static const int dy[4] = {0, 1, 0, -1}, dx[4] = {1, 0, -1, 0...
#include <bits/stdc++.h> #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; using i64 = int64_t; using f80 = __float80; static const int dy[4] = {0, 1, 0, -1}, dx[4] = {1, 0, -1, 0...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
536
/*"Success isn't permanent, failure isn't fatal, it's the courage to continue that counts"*/ #include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; // typedef tree<int, null_type, less<in...
/*"Success isn't permanent, failure isn't fatal, it's the courage to continue that counts"*/ #include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; // typedef tree<int, null_type, less<in...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 85]]
1
292
#include <bits/stdc++.h> #pragma GCC optimize("O2") using namespace std; #define FASTIO ios_base::sync_with_stdio(false), cin.tie(0) //#define MULTI_TEST //#define GOOGLE #ifdef LOCAL #include "debugger.h" #else #define db(...) #endif #define ll long long #define v32 vector<int> #define v64 vector<ll> #define s32 set<i...
#include <bits/stdc++.h> #pragma GCC optimize("O2") using namespace std; #define FASTIO ios_base::sync_with_stdio(false), cin.tie(0) //#define MULTI_TEST //#define GOOGLE #ifdef LOCAL #include "debugger.h" #else #define db(...) #endif #define ll long long #define v32 vector<int> #define v64 vector<ll> #define s32 set<i...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
488
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; if (n == 2) { cout << 1 << endl; } else if (n == 3) { cout << 2 << endl; } long long ans = 2; for (long long i = 2; i * i <= n; ++i) { long long m = n; if (m % i == 0) { while (m % i == 0) { m ...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; if (n == 2) { cout << 1 << endl; } else if (n == 3) { cout << 2 << endl; } else { long long ans = 2; for (long long i = 2; i * i <= n; ++i) { long long m = n; if (m % i == 0) { while (m % i =...
[["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46]]
1
174
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef unsigned long long int ulli; const lli INF = 1e9 + 100; const lli INF64 = (1LL << 61) + 100; const lli MOD = 1e9 + 7; const lli MH1 = 1599614977, MH2 = 2034417103, MH3 = 1090250123, MH4 = 2024491871; lli bpow(lli baseee, lli expo...
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef unsigned long long int ulli; const lli INF = 1e9 + 100; const lli INF64 = (1LL << 61) + 100; const lli MOD = 1e9 + 7; const lli MH1 = 1599614977, MH2 = 2034417103, MH3 = 1090250123, MH4 = 2024491871; lli bpow(lli baseee, lli expo...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
496
#include <iostream> #include <vector> using namespace std; using ll = long long; vector<ll> enumDivisor(ll n) { vector<ll> res; for (ll i = 1; i * i <= n; i++) { if (n % i != 0) continue; res.push_back(i); if (i * i != 0) res.push_back(n / i); } return res; } int main() { ll n; cin ...
#include <iostream> #include <vector> using namespace std; using ll = long long; vector<ll> enumDivisor(ll n) { vector<ll> res; for (ll i = 1; i * i <= n; i++) { if (n % i != 0) continue; res.push_back(i); if (i * i != n) res.push_back(n / i); } return res; } int main() { ll n; cin ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
176
n = int(input()) # 例外処理 if n == 2: print(0) exit() if n == 3: print(1) exit() # n % k = 1 の数 m = n - 1 i = 2 ans = 1 while i * i <= m: if m % i == 0: num = 1 while m % i == 0: num += 1 m //= i ans *= num i = i + 1 if m != 1: ans *= 2 ans -= 1...
n = int(input()) # 例外処理 if n == 2: print(1) exit() if n == 3: print(2) exit() # n % k = 1 の数 m = n - 1 i = 2 ans = 1 while i * i <= m: if m % i == 0: num = 1 while m % i == 0: num += 1 m //= i ans *= num i = i + 1 if m != 1: ans *= 2 ans -= 1...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
283
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i < (n + 1); ++i) using namespace std; using ll = long long; const int INF = +100100100; typedef pair<int, int> P; vector<ll> enumdivisor(ll n) { vector<ll> y; for (ll k = 1; k * k < n...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i < (n + 1); ++i) using namespace std; using ll = long long; const int INF = +100100100; typedef pair<int, int> P; vector<ll> enumdivisor(ll n) { vector<ll> y; for (ll k = 1; k * k <= ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
207
#include <algorithm> #include <complex> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, m, n) for (int i...
#include <algorithm> #include <complex> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, m, n) for (int i...
[["-", 15, 339, 51, 16, 31, 16, 31, 16, 17, 48], ["-", 15, 339, 51, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 85], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 22]]
1
513
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n); i > 0; i--) #define print(n) cout << n << "\n" int main() { ll n; cin >> n; ll k = 2, nn; unordered_set<ll> ans = {n}; if (n > 2) ans = {n - 1}; whi...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n); i > 0; i--) #define print(n) cout << n << "\n" int main() { ll n; cin >> n; ll k = 2, nn; unordered_set<ll> ans = {n}; if (n > 2) ans.insert(n - 1); ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 1, 0, 11, 12, 83, 0, 45], ["+", 0, 57, 64, 1, 0, 2, 63, 118, 17, 131], ["+", 0, 57, 64, 1, 0, 2, 63, 118, 119, 120], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 57, 64, 1, 0, 11, 12, 83, 0, 46], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 25]]
1
174
// It doesn't matter how slow you go, Unless you don't stop. #include <algorithm> #include <bitset> #include <iostream> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <map> #include <queue> #include <set> #include <unordered_map> #include <unordered_set> #include <vector> #include ...
// It doesn't matter how slow you go, Unless you don't stop. #include <algorithm> #include <bitset> #include <iostream> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <map> #include <queue> #include <set> #include <unordered_map> #include <unordered_set> #include <vector> #include ...
[["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89]]
1
406
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; // MACROS #define ll long long #define ull unsigned long long #define ld long double #define vi vector<int> #define vll vector<ll> #define vld vector<ld> #define u_s unordered_set #define pii pair<int...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; // MACROS #define ll long long #define ull unsigned long long #define ld long double #define vi vector<int> #define vll vector<ll> #define vld vector<ld> #define u_s unordered_set #define pii pair<int...
[["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25]]
1
378
#include <bits/stdc++.h> using namespace std; // #define int long long #define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i) #define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i > 0; i--) #define ir...
#include <bits/stdc++.h> using namespace std; // #define int long long #define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i) #define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i > 0; i--) #define ir...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
857
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i <= (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; vector<ll> Yakusu(ll n) { vector<ll> res; for (ll i = 1; i * i <= n; ++i) { if (n % i != 0) continue; res.push_back(i); if (i * i != n) res.push_b...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i <= (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; vector<ll> Yakusu(ll n) { vector<ll> res; for (ll i = 1; i * i <= n; ++i) { if (n % i != 0) continue; res.push_back(i); if (i * i != n) res.push_b...
[["-", 8, 9, 0, 52, 15, 339, 51, 11, 17, 132], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60]]
1
192
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unorder...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unorder...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22]]
1
760
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll k; cin >> k; ll count = 2; if (k == 2) { cout << 1 << endl; return 0; } for (int i = 2; i <= pow(k, 0.5) + 1; i++) { ll K = k; if (K % i == 0) { while (K % i == 0) { K /= i; } if ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll k; cin >> k; ll count = 2; if (k == 2) { cout << 1 << endl; return 0; } for (int i = 2; i <= pow(k, 0.5); i++) { ll K = k; if (K % i == 0) { while (K % i == 0) { K /= i; } if (K =...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
177
N = int(input()) def divisor(N): ret = [] for i in range(1, int(N**0.5)+1): if N % i == 0: ret.append(i) if N // i != i: ret.append(N//i) return ret div_N = divisor(N) div_N_1 = divisor(N-1) ans = 0 for k in div_N[1:]: n = N while n % k == 0: ...
N = int(input()) def divisor(N): ret = [] for i in range(1, int(N**0.5)+1): if N % i == 0: ret.append(i) if N // i != i: ret.append(N//i) return ret div_N = divisor(N) div_N_1 = divisor(N-1) ans = 0 for k in div_N[1:]: n = N while n % k == 0: ...
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22], ["+", 0, 656, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 0, 656, 0, 1, 0, 677, 12, 657, 12, 612]]
5
122