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
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <string> #define REP(_i, _a, _n) for (int _i = _a; _i <= _n; ++_i) #define PER(_i, _a, _n) f...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <string> #define REP(_i, _a, _n) for (int _i = _a; _i <= _n; ++_i) #define PER(_i, _a, _n) f...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
408
// omajinai c++ atcoder #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdint> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <type_traits> #includ...
// omajinai c++ atcoder #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdint> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <type_traits> #includ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
146
a,v=list(map(int,input().split())) b,w=list(map(int,input().split())) t=int(input()) if w*t*(abs(a-b))<=v*t: print("YES") else: print("NO")
a,v=list(map(int,input().split())) b,w=list(map(int,input().split())) t=int(input()) if w*t+(abs(a-b))<=v*t: print("YES") else: print("NO")
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 48], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 72]]
5
78
def main1(): A,V=map(int,input().split()) B,W=map(int,input().split()) T=int(input()) if (V-W)*T >= B-A: print("YES") else: print("NO") main1()
def main1(): A,V=map(int,input().split()) B,W=map(int,input().split()) T=int(input()) if (V-W)*T >= abs(B-A): print("YES") else: print("NO") main1()
[["+", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]]
5
75
#include <bits/stdc++.h> using namespace std; using lint = long long int; using P = pair<lint, lint>; #define FOR(i, begin, end) \ for (int i = (begin), i##_end_ = (end); i < i##_end_; i++) #define IFOR(i, begin, end) ...
#include <bits/stdc++.h> using namespace std; using lint = long long int; using P = pair<lint, lint>; #define FOR(i, begin, end) \ for (int i = (begin), i##_end_ = (end); i < i##_end_; i++) #define IFOR(i, begin, end) ...
[["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 2, 3, 4, 0, 25]]
1
219
A, V = map(int, input().split()) B, W = map(int, input().split()) T = int(input()) d = V - W if d > 0 and abs(A - B) // d <= T: print("YES") else: print("NO")
A, V = map(int, input().split()) B, W = map(int, input().split()) T = int(input()) d = V - W if d > 0 and abs(A - B) / d <= T: print("YES") else: print("NO")
[["-", 0, 57, 15, 679, 12, 666, 0, 657, 17, 676], ["+", 0, 57, 15, 679, 12, 666, 0, 657, 17, 85]]
5
75
#include <bits/stdc++.h> using namespace std; using ll = long long int; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { ll a, b; ll v, w; ll t; cin >> a >> v; cin >> b >> w; cin >> t; ll kyori = abs(a - b); ll sa = v - w; if (sa * t >= kyori) cout << "Yes" << endl; else cout <<...
#include <bits/stdc++.h> using namespace std; using ll = long long int; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { ll a, b; ll v, w; ll t; cin >> a >> v; cin >> b >> w; cin >> t; ll kyori = abs(a - b); ll sa = v - w; if (sa * t >= kyori) cout << "YES" << endl; else cout <<...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
98
#include <bits/stdc++.h> using namespace std; using i64 = long long; #define endl "\n" int main() { i64 A, V, B, W, T; cin >> A >> V >> B >> W >> T; if ((V - W) * T < abs(A - B)) cout << "No" << endl; else cout << "Yes" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using i64 = long long; #define endl "\n" int main() { i64 A, V, B, W, T; cin >> A >> V >> B >> W >> T; if ((V - W) * T < abs(A - B)) cout << "NO" << endl; else cout << "YES" << endl; return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
81
A, V = (int(i) for i in input().split()) B, W = (int(i) for i in input().split()) T = int(input()) if V <= W: print("No") else: if abs(A - B) / (V - W) <= T: print("YES") else: print("NO")
A, V = (int(i) for i in input().split()) B, W = (int(i) for i in input().split()) T = int(input()) if V <= W: print("NO") else: if abs(A - B) / (V - W) <= T: print("YES") else: print("NO")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
91
a = input().split() b = input().split() t = input() d = abs(int(a[0]) - int(b[0])) if (int(a[1]) <= int(b[1])): print('No') else: sek = int(a[1]) - int(b[1]) if d <= int(t)*sek: print('YES') else : print('NO')
a = input().split() b = input().split() t = input() d = abs(int(a[0]) - int(b[0])) if (int(a[1]) <= int(b[1])): print('NO') else: sek = int(a[1]) - int(b[1]) if d <= int(t)*sek: print('YES') else : print('NO')
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
111
#include <bits/stdc++.h> using namespace std; int main() { long long int A, V, B, W, T; cin >> A >> V; cin >> B >> W; cin >> T; if (V < W || (V == W && A != B)) { cout << "NO" << endl; } else if (A == B || abs(A - B) < (V - W) * T) { cout << "YES" << endl; } else { cout << "NO" << endl; }...
#include <bits/stdc++.h> using namespace std; int main() { long long int A, V, B, W, T; cin >> A >> V; cin >> B >> W; cin >> T; if (V < W || (V == W && A != B)) { cout << "NO" << endl; } else if (A == B || abs(A - B) <= (V - W) * T) { cout << "YES" << endl; } else { cout << "NO" << endl; ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
110
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define F first #define S second #define int long long #define lint long long #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define sz(x) (int)x.size() #define all(x) beg...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define F first #define S second #define int long long #define lint long long #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define sz(x) (int)x.size() #define all(x) beg...
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]]
1
170
A,V=map(int,input().split()) B,W=map(int,input().split()) T=int(input()) if W>=V: print('No') else: key=abs(A-B) if key+W*T>V*T: print('No') else: print('Yes')
A,V=map(int,input().split()) B,W=map(int,input().split()) T=int(input()) if W>=V: print('NO') else: key=abs(A-B) if key+W*T>V*T: print('NO') else: print('YES')
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
86
A,V = map(int,input().split()) B,W = map(int,input().split()) T = int(input()) if (B-A) - (V - W)*T <= 0: print('YES') else: print('NO')
A,V = map(int,input().split()) B,W = map(int,input().split()) T = int(input()) if abs(B-A) - (V - W)*T <= 0: print('YES') else: print('NO')
[["+", 0, 57, 15, 666, 0, 657, 31, 652, 63, 22]]
5
71
/* * @Author: BilyHurington * @Date: 2020-06-13 20:03:44 * @LastEditors: BilyHurington * @LastEditTime: 2020-06-13 20:04:44 */ #include <bits/stdc++.h> using namespace std; long long A, V, B, W, T; int main() { scanf("%lld %lld %lld %lld %lld", &A, &V, &B, &W, &T); if ((V - W) * T > abs(A - B)) printf("YES...
/* * @Author: BilyHurington * @Date: 2020-06-13 20:03:44 * @LastEditors: BilyHurington * @LastEditTime: 2020-06-13 20:07:48 */ #include <bits/stdc++.h> using namespace std; long long A, V, B, W, T; int main() { scanf("%lld %lld %lld %lld %lld", &A, &V, &B, &W, &T); if ((V - W) * T >= abs(A - B)) printf("YE...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
82
import sys def _i(): return int(sys.stdin.readline().strip()) def _ia(): return map(int, sys.stdin.readline().strip().split()) def main(): a, v = _ia() b, w = _ia() t = _i() if a > b: ans = "Yes" if a - (v-w) * t <= b else "No" else: ans = "Yes" if a + (v-w) * t >= b else "No" ...
import sys def _i(): return int(sys.stdin.readline().strip()) def _ia(): return map(int, sys.stdin.readline().strip().split()) def main(): a, v = _ia() b, w = _ia() t = _i() if a > b: ans = "YES" if a - (v-w) * t <= b else "NO" else: ans = "YES" if a + (v-w) * t >= b else "NO" ...
[["-", 0, 1, 0, 662, 12, 41, 0, 557, 0, 6], ["+", 0, 1, 0, 662, 12, 41, 0, 557, 0, 6]]
5
136
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1000000007 using namespace std; int main() { long a, v, b, w, t; cin >> a >> v >> b >> w >> t; if ((abs(w - v)) * t >= abs(b - a)) cout << "YES" << endl; else cout << "NO\n"; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1000000007 using namespace std; int main() { long a, v, b, w, t; cin >> a >> v >> b >> w >> t; if ((abs(w - v)) * t >= abs(b - a) && v > w) cout << "YES" << endl; else cout << "NO\n"; return 0; }
[["+", 8, 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, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
85
#include <algorithm> #include <iostream> #include <numeric> #include <string> #include <tuple> #include <utility> #include <vector> #define REP(i, a, b) for (int i = int(a); i < int(b); i++) using namespace std; using ll = long long int; using P = pair<ll, ll>; // clang-format off #ifdef _DEBUG_ #define dump(...) do{...
#include <algorithm> #include <iostream> #include <numeric> #include <string> #include <tuple> #include <utility> #include <vector> #define REP(i, a, b) for (int i = int(a); i < int(b); i++) using namespace std; using ll = long long int; using P = pair<ll, ll>; // clang-format off #ifdef _DEBUG_ #define dump(...) do{...
[["-", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["-", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6]]
1
414
#include <algorithm> #include <cctype> #include <cmath> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <time.h> #include <tuple> #include <vector> using namespace std; const ...
#include <algorithm> #include <cctype> #include <cmath> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <time.h> #include <tuple> #include <vector> using namespace std; const ...
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]]
1
757
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef pair<int, int> i_i; #define reps(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) reps(i, 0, n) #define ALL(v) v.begin(), v.end() #define SZ(x) ((int)(x).size()) template <class T> inline bool chmin(T &a, T b) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef pair<int, int> i_i; #define reps(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) reps(i, 0, n) #define ALL(v) v.begin(), v.end() #define SZ(x) ((int)(x).size()) template <class T> inline bool chmin(T &a, T b) { ...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
184
package main import "fmt" func abs(a int) int { if a < 0 { return -a } return a } func main() { var a, b, v, w, t int fmt.Scan(&a, &v, &b, &w, &t) if t*(v-w) >= abs(b-a) { fmt.Println("Yes") } else { fmt.Println("No") } }
package main import "fmt" func abs(a int) int { if a < 0 { return -a } return a } func main() { var a, b, v, w, t int fmt.Scan(&a, &v, &b, &w, &t) if t*(v-w) >= abs(b-a) { fmt.Println("YES") } else { fmt.Println("NO") } }
[]
7
110
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define rep2(i, s, n) for (long long i = (s); i < (long long)(n); i++) #define repi(i, n) for (int i = 0; i < (int)(n); i++) #define rep2i(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(v) v.begin(...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define rep2(i, s, n) for (long long i = (s); i < (long long)(n); i++) #define repi(i, n) for (int i = 0; i < (int)(n); i++) #define rep2i(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(v) v.begin(...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
247
#include <bits/stdc++.h> using namespace std; using Graph = vector<vector<int>>; int main() { long long A, V; cin >> A >> V; long long B, W; cin >> B >> W; long long T; cin >> T; long long dist = abs(A - B); long long speed = (V - W); if (speed * T - dist >= 0) cout << "Yes" << endl; else ...
#include <bits/stdc++.h> using namespace std; using Graph = vector<vector<int>>; int main() { long long A, V; cin >> A >> V; long long B, W; cin >> B >> W; long long T; cin >> T; long long dist = abs(A - B); long long speed = (V - W); if (speed * T - dist >= 0) cout << "YES" << endl; else ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
103
a,v=map(int,input().split()) b,w=map(int,input().split()) T=int(input()) if (v*T)-(w*T)>abs(a-b): print("YES") else: print("NO")
import math a,v=map(int,input().split()) b,w=map(int,input().split()) T=int(input()) if (v*T)-(w*T)>=abs(a-b): print("YES") else: print("NO")
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
74
A,V=map(int,(input().split())) B,W=map(int,(input().split())) T=int(input()) dist=abs(A-B) sp=abs(V-W) if(sp*T>=dist): print("YES") else: print("NO")
A,V=map(int,(input().split())) B,W=map(int,(input().split())) T=int(input()) dist=abs(A-B) sp=V-W if(sp*T>=dist): print("YES") else: print("NO")
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
83
#include <bits/stdc++.h> using namespace std; const auto start_time = std::chrono::high_resolution_clock::now(); void timecalculater() { #ifndef ONLINE_JUDGE auto end_time = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> diff = end_time - start_time; cerr << "Time Taken : " << diff.count...
#include <bits/stdc++.h> using namespace std; const auto start_time = std::chrono::high_resolution_clock::now(); void timecalculater() { #ifndef ONLINE_JUDGE auto end_time = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> diff = end_time - start_time; cerr << "Time Taken : " << diff.count...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
718
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define INF 100000000 #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define mp make_pair ll mod = 10e9 + 7; ll mod2 = 998244353; int main() { int a, v; cin >> a >> v; int b, w; ci...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define INF 100000000 #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define mp make_pair ll mod = 10e9 + 7; ll mod2 = 998244353; int main() { ll a, v; cin >> a >> v; ll b, w; cin ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33]]
1
164
#include <bits/stdc++.h> using namespace std; int main() { int A, V, B, W, T; cin >> A >> V >> B >> W >> T; if (V <= W) { puts("NO"); return 0; } int get = (abs(B - A) / (V - W)); if (get < 0) { puts("NO"); } else { puts(get <= T ? "YES" : "NO"); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long double A, V, B, W, T; cin >> A >> V >> B >> W >> T; if (V <= W) { puts("NO"); return 0; } long double get = (abs(B - A) / (V - W)); if (get < 0) { puts("NO"); } else { puts(get <= T ? "YES" : "NO"); } return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40]]
1
107
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <stack> #include <string> ...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <stack> #include <string> ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
1,973
a, v = map(int, input().split()) b, w = map(int, input().split()) t = int(input()) if v <= w: print("NO") elif abs(a-b) // abs(v-w) <= t: print("YES") else: print("NO")
a, v = map(int, input().split()) b, w = map(int, input().split()) t = int(input()) if v <= w: print("NO") elif abs(a-b) / abs(v-w) <= t: print("YES") else: print("NO")
[["-", 0, 57, 75, 665, 15, 666, 0, 657, 17, 676], ["+", 0, 57, 75, 665, 15, 666, 0, 657, 17, 85]]
5
82
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (auto &&e : a) { cin >> e; } for (int i = 0; i < 100; ++i) { vector<int> tmp(n, 0); for (int j = 0; j < n; ++j) { int l = max(0, j -...
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (auto &&e : a) { cin >> e; } for (int i = 0; i < min(k, 100); ++i) { vector<int> tmp(n, 0); for (int j = 0; j < n; ++j) { int l = ma...
[["+", 8, 9, 0, 7, 15, 16, 12, 2, 63, 22], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 25]]
1
226
n,k=map(int,input().split()) a=list(map(int,input().split())) b=[0]*n c=[0]*n cnt=0 while cnt<101: cnt+=1 for i in range(n): b[max(0,i-a[i])]+=1 if i+a[i]<n-1: b[i+a[i]+1]-=1 c[0]=b[0] for j in range(n-1): c[j+1]=c[j]+b[j+1] a=c b=[0]*n c=[0]*n print(*a)
n,k=map(int,input().split()) a=list(map(int,input().split())) b=[0]*n c=[0]*n cnt=0 while cnt<min(k,101): cnt+=1 for i in range(n): b[max(0,i-a[i])]+=1 if i+a[i]<n-1: b[i+a[i]+1]-=1 c[0]=b[0] for j in range(n-1): c[j+1]=c[j]+b[j+1] a=c b=[0]*n c=[0]*n print(*a)
[["+", 0, 656, 0, 52, 15, 666, 0, 652, 63, 22], ["+", 0, 52, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 52, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 52, 15, 666, 0, 652, 3, 4, 0, 21], ["+", 0, 52, 15, 666, 0, 652, 3, 4, 0, 25]]
5
166
#include <bits/stdc++.h> using namespace std; #define watch(x) cerr << (#x) << ": " << (x) << endl typedef long long LL; const int N = 200009; int n, k, a[N], b[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; for (int i = 0; i < n; ++i) { cin >> a[i]; } LL tot = 0...
#include <bits/stdc++.h> using namespace std; #define watch(x) cerr << (#x) << ": " << (x) << endl typedef long long LL; const int N = 200009; int n, k, a[N], b[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; for (int i = 0; i < n; ++i) { cin >> a[i]; } LL tot = 0...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
304
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ...
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ...
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["-", 3, 4, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 3, 4, 0, 16, 12, 69, 341, 342, 0, 22]]
1
365
N, K = map(int, input().split()) A = list(map(int, input().split())) for _ in range(min(K, 50)): lamp = [0 for i in range(N + 1)] for i in range(N): lamp[max(0, i - A[i])] += 1 lamp[min(N, i + A[i] + 1)] -= 1 print(lamp) for i in range(1, N + 1): lamp[i] += lamp[i - 1] A = ...
N, K = map(int, input().split()) A = list(map(int, input().split())) for _ in range(min(K, 50)): lamp = [0 for i in range(N + 1)] for i in range(N): lamp[max(0, i - A[i])] += 1 lamp[min(N, i + A[i] + 1)] -= 1 for i in range(1, N + 1): lamp[i] += lamp[i - 1] A = lamp [print(A[i...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
157
#include <bits/stdc++.h> using namespace std; // エイリアス using ll = long signed long; using ull = long unsigned long; using ld = long double; using P = pair<int, int>; using llP = pair<ll, ll>; using DoP = pair<double, double>; // 汎用マクロ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #def...
#include <bits/stdc++.h> using namespace std; // エイリアス using ll = long signed long; using ull = long unsigned long; using ld = long double; using P = pair<int, int>; using llP = pair<ll, ll>; using DoP = pair<double, double>; // 汎用マクロ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #def...
[["-", 15, 339, 51, 16, 31, 66, 28, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 66, 28, 2, 63, 22]]
1
921
# 問題文の意味がわからんコンテスト # 0の場合も自分自身を照らす、っての気づくところからやっと読解 # Kを5000兆回やったあとはすべての要素がNになっとる この収束はわりと早いらしい n, k = map(int, input().split()) a = list(map(int, input().split())) for _ in range(50): b = [0] * (n + 1) for i in range(n): b[max(0, i - a[i])] += 1 b[min(n, i + a[i] + 1)] -= 1 for i in range...
# 問題文の意味がわからんコンテスト # 0の場合も自分自身を照らす、っての気づくところからやっと読解 # Kを5000兆回やったあとはすべての要素がNになっとる この収束はわりと早いらしい n, k = map(int, input().split()) a = list(map(int, input().split())) for _ in range(min(k, 100)): b = [0] * (n + 1) for i in range(n): b[max(0, i - a[i])] += 1 b[min(n, i + a[i] + 1)] -= 1 for i...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
142
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define pb push_back #define COUT(x) cout << (x) << "\n" #define COUTF(x) cout << setprecision(15) << (x) << "\n" #define ENDL cout << "\n" #d...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define pb push_back #define COUT(x) cout << (x) << "\n" #define COUTF(x) cout << setprecision(15) << (x) << "\n" #define ENDL cout << "\n" #d...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
1,274
N, K = map(int, input().split()) X = list(map(int, input().split())) x = X[:] + [0] for _ in range(K): if all(v == N for v in x[:-1]): break new = [0] * (N + 1) for i in range(N): new[max(0, i - x[i])] += 1 new[min(N, i + x[i] + 1)] -= 1 for i in range(N): new[i + 1] ...
N, K = map(int, input().split()) X = list(map(int, input().split())) x = X[:] + [0] for _ in range(K): if all(v == N for v in x[:-1]): break new = [0] * (N + 1) for i in range(N): new[max(0, i - x[i])] += 1 new[min(N, i + x[i] + 1)] -= 1 for i in range(N): new[i + 1] ...
[["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 102], ["+", 3, 4, 0, 206, 206, 663, 0, 664, 17, 33], ["+", 3, 4, 0, 206, 206, 663, 0, 664, 28, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73]]
5
152
import sys,queue,math,copy,itertools,bisect,collections,heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] _LI = lambda : [-int(x) for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline())...
import sys,queue,math,copy,itertools,bisect,collections,heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] _LI = lambda : [-int(x) for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline())...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 147], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 146], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 146], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 147]]
5
289
#include <bits/stdc++.h> #pragma GCC optimize "Ofast,omit-frame-pointer,inline" using namespace std; typedef long long ll; #define REP(i, n) for (int i = 0; i < int(n); i++) #define FOR(i, m, n) for (int i = int(m); i < int(n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define VI vector<int> #define VP vector<p...
#include <bits/stdc++.h> #pragma GCC optimize "Ofast,omit-frame-pointer,inline" using namespace std; typedef long long ll; #define REP(i, n) for (int i = 0; i < int(n); i++) #define FOR(i, m, n) for (int i = int(m); i < int(n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define VI vector<int> #define VP vector<p...
[["-", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22]]
1
424
n, k = map(int, input().split()) a = list(map(int, input().split())) for j in range(41): b = [0]*n for i in range(n): l = max(0, i-a[i]) r = min(n, i+a[i]+1) b[l] += 1 if r < n: b[r] -= 1 for i in range(1, n): b[i]+=b[i-1] a = b print(" ".join(list(map(str, a))))
n, k = map(int, input().split()) a = list(map(int, input().split())) for j in range(min(k, 41)): b = [0]*n for i in range(n): l = max(0, i-a[i]) r = min(n, i+a[i]+1) b[l] += 1 if r < n: b[r] -= 1 for i in range(1, n): b[i]+=b[i-1] a = b print(" ".join(list(map(str, a))))
[["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
144
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pa pair<int, int> #define pal pair<long long, long long> #define pali pair<long long, int> #define pad pair<double, double> #define pb push_back #define mp make_pair #define COUT(v) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pa pair<int, int> #define pal pair<long long, long long> #define pali pair<long long, int> #define pad pair<double, double> #define pb push_back #define mp make_pair #define COUT(v) ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
1,453
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll MOD = 1000000007; #define vec vector<int> #define vecll vector<ll> #define vecd vector<double> #define vecst vector<string> #define vecb vector<bool> #define vec2(var, n, m) vector<vector<int>> var(n, vector<int>(m, 0)) #define vecll2(var, n, m) ve...
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll MOD = 1000000007; #define vec vector<int> #define vecll vector<ll> #define vecd vector<double> #define vecst vector<string> #define vecb vector<bool> #define vec2(var, n, m) vector<vector<int>> var(n, vector<int>(m, 0)) #define vecll2(var, n, m) ve...
[["-", 8, 9, 0, 9, 0, 1, 0, 27, 28, 22], ["-", 8, 9, 0, 9, 0, 1, 0, 27, 17, 68], ["-", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]]
1
438
#include <bits/stdc++.h> typedef long long int lld; typedef unsigned long long int llu; #define INF (lld)(9223372036854775807) #define IINF (int)(2147483647) using namespace std; int main(void) { int n, k; cin >> n >> k; vector<vector<int>> a; a.push_back(vector<int>(n + 1)); for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> typedef long long int lld; typedef unsigned long long int llu; #define INF (lld)(9223372036854775807) #define IINF (int)(2147483647) using namespace std; int main(void) { int n, k; cin >> n >> k; vector<vector<int>> a; a.push_back(vector<int>(n + 1)); for (int i = 0; i < n; i++) { ...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
299
#include <bits/stdc++.h> #define trace1(a) cout << #a << ": " << a << endl #define trace2(a, b) cout << #a << ": " << a << " | ", trace1(b) #define trace3(a, b, c) cout << #a << ": " << a << " | ", trace2(b, c) #define trace4(a, b, c, d) cout << #a << ": " << a << " | ", trace3(b, c, d) #define trace5(a, b, c, d, e) ...
#include <bits/stdc++.h> #define trace1(a) cout << #a << ": " << a << endl #define trace2(a, b) cout << #a << ": " << a << " | ", trace1(b) #define trace3(a, b, c) cout << #a << ": " << a << " | ", trace2(b, c) #define trace4(a, b, c, d) cout << #a << ": " << a << " | ", trace3(b, c, d) #define trace5(a, b, c, d, e) ...
[["-", 0, 2, 3, 4, 0, 16, 31, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["-", 3, 4, 0, 16, 31, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
2,046
/*ver 4*/ #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; void init() { cin.tie(0); ios::sync_...
/*ver 4*/ #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; void init() { cin.tie(0); ios::sync_...
[["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
2,271
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (ll i = a; i < b; i++) #define REP(i, b) FOR(i, 0, b) #define RFOR(i, a, b) for (ll i = a - 1; i >= b; i--) #define RREP(i, a) RFOR(i, a, 0) #define REPALL(i, x) for (ll i = 0; i < x.size(); i++) #define RREPALL(i, x) for (ll i = x.size() - 1; i >= ...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (ll i = a; i < b; i++) #define REP(i, b) FOR(i, 0, b) #define RFOR(i, a, b) for (ll i = a - 1; i >= b; i--) #define RREP(i, a) RFOR(i, a, 0) #define REPALL(i, x) for (ll i = 0; i < x.size(); i++) #define RREPALL(i, x) for (ll i = x.size() - 1; i >= ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
505
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define srep(i, n, m) for (int i = n; i < m; i++) #define...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define srep(i, n, m) for (int i = n; i < m; i++) #define...
[["-", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 3, 4, 0, 2, 3, 4, 0, 74, 0, 24], ["+", 3, 4, 0, 74, 39, 77, 39, 86, 0, 96], ["+", 3, 4, 0, 2, 3, 4, 0, 74, 0, 25], ["+", 3, 4, 0, 2, 3, 4, 0, 74, 51, 13]]
1
336
from itertools import accumulate def mi(): return map(int, input().split()) def main(): N, K = mi() A = list(mi()) for _ in range(K): l = [0]*N for i in range(N): left = max(i-A[i], 0) right = min(i+A[i]+1, N) l[left] += 1 if right < N: ...
from itertools import accumulate def mi(): return map(int, input().split()) def main(): N, K = mi() A = list(mi()) for _ in range(K): l = [0]*N for i in range(N): left = max(i-A[i], 0) right = min(i+A[i]+1, N) l[left] += 1 if right < N: ...
[["+", 64, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
159
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vector<ll>> vvll; typedef vector<vector<vector<ll>>> vvvll; typedef vector<bool> vb; typedef vector<vector<bool>> vvb; typedef vector<vector<vector<bool>>> vvvb; typedef pair<ll, ll> pll; typedef vector<pll> vpll...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vector<ll>> vvll; typedef vector<vector<vector<ll>>> vvvll; typedef vector<bool> vb; typedef vector<vector<bool>> vvb; typedef vector<vector<vector<bool>>> vvvb; typedef pair<ll, ll> pll; typedef vector<pll> vpll...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
2,232
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define ll long long #define P pair<int, int> #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define ll long long #define P pair<int, int> #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 93, 0, 94]]
1
271
// Problem : C - Lamps // Contest : AtCoder - Tokio Marine & Nichido Fire Insurance Programming Contest // 2020 URL : // https://atcoder.jp/contests/tokiomarine2020/tasks/tokiomarine2020_c Memory // Limit : 1024 MB Time Limit : 2000 ms Powered by CP Editor // (https://github.com/cpeditor/cpeditor) #pragma GCC optimiz...
// Problem : C - Lamps // Contest : AtCoder - Tokio Marine & Nichido Fire Insurance Programming Contest // 2020 URL : // https://atcoder.jp/contests/tokiomarine2020/tasks/tokiomarine2020_c Memory // Limit : 1024 MB Time Limit : 2000 ms Powered by CP Editor // (https://github.com/cpeditor/cpeditor) #pragma GCC optimize...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 48], ["+", 12, 16, 12, 2, 3, 4, 0, 74, 0, 24], ["+", 12, 2, 3, 4, 0, 74, 39, 77, 39, 78], ["+", 12, 16, 12, 2, 3, 4, 0, 74, 0, 25]]
1
488
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 9; int a[maxn]; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; while (k--) { int b[maxn]; memset(b, 0, sizeof(b)); for (int i = 1; i <= n; i++) { int l = max(1, i - a[i]); int r = mi...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 9; int a[maxn]; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; while (k--) { int b[maxn]; memset(b, 0, sizeof(b)); for (int i = 1; i <= n; i++) { int l = max(1, i - a[i]); int r = mi...
[["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
226
#include <bits/stdc++.h> #define INF 2000000000000000000 #define ll long long #define pll pair<ll, ll> using namespace std; ll N, K; void perm(vector<ll> &A) { vector<ll> imos(N + 1, 0); for (ll i = 0; i < N; ++i) { ll a = A.at(i); imos.at(max(0ll, i - a)) += 1; imos.at(min(N, i + a + 1)) -= 1; } f...
#include <bits/stdc++.h> #define INF 2000000000000000000 #define ll long long #define pll pair<ll, ll> using namespace std; ll N, K; void perm(vector<ll> &A) { vector<ll> imos(N + 1, 0); for (ll i = 0; i < N; ++i) { ll a = A.at(i); imos.at(max(0ll, i - a)) += 1; imos.at(min(N, i + a + 1)) -= 1; } f...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 15, 339, 51, 16, 31, 2, 3, 4, 0, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
370
#pragma GCC optimize("O2") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\...
#pragma GCC optimize("O2") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
1
256
#import sys #import numpy as np import math #from fractions import Fraction import itertools from collections import deque from collections import Counter #import heapq #from fractions import gcd #input=sys.stdin.readline import bisect n,k=map(int,input().split()) a=list(map(int,input().split())) c=0 while True: b...
#import sys #import numpy as np import math #from fractions import Fraction import itertools from collections import deque from collections import Counter #import heapq #from fractions import gcd #input=sys.stdin.readline import bisect n,k=map(int,input().split()) a=list(map(int,input().split())) c=0 while True: b...
[["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]]
5
189
#include <algorithm> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> #define ll long long using namespace std; long long MOD = 1000000007; template <typename T> void cout_vec(vector<T> &v...
#include <algorithm> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> #define ll long long using namespace std; long long MOD = 1000000007; template <typename T> void cout_vec(vector<T> &v...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
304
n, k = map(int, input().split()) a = list(map(int, input().split())) for i in range(k): acc = [0 for j in range(n+1)] for j in range(n): acc[max(0, j - a[j])] += 1 acc[min(n-1, j + a[j]) + 1] -= 1 for j in range(n): acc[j+1] += acc[j] a = acc[:-1] if sum(a) == n * n: ...
n, k = map(int, input().split()) a = list(map(int, input().split())) for i in range(k): acc = [0 for j in range(n+1)] for j in range(n): acc[max(0, j - a[j])] += 1 acc[min(n-1, j + a[j]) + 1] -= 1 for j in range(n): acc[j+1] += acc[j] a = acc[:-1] if sum(a) == n * n: ...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
159
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; i++) #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define per(i, n) for (ll i = n - 1; i >= 0; i--) #define perl(i, r, l) for (ll i = r - 1; i >= l; i--) #define fi first #define se second #define pb push...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; i++) #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define per(i, n) for (ll i = n - 1; i >= 0; i--) #define perl(i, r, l) for (ll i = r - 1; i >= l; i--) #define fi first #define se second #define pb push...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
556
#include <bits/stdc++.h> using namespace std; int N, K, l, r; int main() { cin >> N >> K; vector<int> A(N); for (int i = 0; i < N; i++) cin >> A[i]; while (K--) { vector<int> B(N + 1, 0); for (int i = 0; i < N; i++) { l = max(0, i - A[i]); r = min(N - 1, i + A[i]); B[l]++; B[...
#include <bits/stdc++.h> using namespace std; int N, K, l, r; int main() { cin >> N >> K; vector<int> A(N); for (int i = 0; i < N; i++) cin >> A[i]; while (K--) { vector<int> B(N + 1, 0); for (int i = 0; i < N; i++) { l = max(0, i - A[i]); r = min(N - 1, i + A[i]); B[l]++; B[...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107]]
1
234
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <string> #include <unordered_map> #include <unordered_set> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define FORR(i, a, b) for (l...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <string> #include <unordered_map> #include <unordered_set> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define FORR(i, a, b) for (l...
[["-", 0, 27, 28, 69, 341, 342, 0, 2, 63, 22], ["+", 0, 27, 28, 69, 341, 342, 0, 2, 63, 22], ["-", 8, 9, 0, 9, 0, 1, 0, 11, 17, 110], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 107]]
1
466
// Practice 40 hours a day to become Ling Ling // Code by Nguyen Huu Lam #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long LL; #define y0 Sword_Art_Online #define y1 Your_lie_in_April #define yn Dar...
// Practice 40 hours a day to become Ling Ling // Code by Nguyen Huu Lam #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long LL; #define y0 Sword_Art_Online #define y1 Your_lie_in_April #define yn Dar...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
517
import java.util.*; import java.util.Map.Entry; class Main { static int mod = (int)(Math.pow(10, 9) + 7); // static int mod = (int) 998244353; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int[][] m = new int[1005][N...
import java.util.*; import java.util.Map.Entry; class Main { static int mod = (int)(Math.pow(10, 9) + 7); // static int mod = (int) 998244353; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int[][] m = new int[1005][N...
[["-", 0, 1, 0, 11, 12, 504, 516, 504, 71, 22], ["+", 0, 11, 12, 504, 516, 504, 71, 16, 31, 22], ["+", 0, 11, 12, 504, 516, 504, 71, 16, 17, 33], ["+", 0, 11, 12, 504, 516, 504, 71, 16, 12, 499], ["-", 12, 504, 516, 504, 71, 492, 3, 4, 0, 499], ["+", 12, 504, 516, 504, 71, 492, 3, 4, 0, 499]]
3
430
#include <bits/stdc++.h> using namespace std; #define ll long long #define MOD 1000000007 #define print(A, n) \ for (ll i = 0; i < n; ++i) \ cout << A[i] << ' '; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define MOD 1000000007 #define print(A, n) \ for (ll i = 0; i < n; ++i) \ cout << A[i] << ' '; ...
[["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46]]
1
634
n, k = map(int, input().split()) a = list(map(int, input().split())) #n = 2 * 10 ** 5 #a = [0] * n cnt = 0 while cnt < k: imos = [0] * (n + 1) for i in range(n): imos[max(i - a[i], 0)] += 1 imos[min(i + a[i] + 1, n)] -= 1 for i in range(n): imos[i + 1] += imos[i] a = imos[0:n...
n, k = map(int, input().split()) a = list(map(int, input().split())) # imos法で区間和を計算する、をk回まで繰り返す cnt = 0 while cnt < k: imos = [0] * (n + 1) for i in range(n): imos[max(i - a[i], 0)] += 1 imos[min(i + a[i] + 1, n)] -= 1 for i in range(n): imos[i + 1] += imos[i] a = imos[0:n] ...
[["-", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22]]
5
140
import sys import math import fractions from collections import defaultdict import numpy as np stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(stdin.readline().rstrip()) nm = lambda: map(int, stdin.readline().split()) nl = lambda: list(map(int, stdin.readline().split())) N,K=nm() A=nl(...
import sys import math import fractions from collections import defaultdict stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(stdin.readline().rstrip()) nm = lambda: map(int, stdin.readline().split()) nl = lambda: list(map(int, stdin.readline().split())) N,K=nm() A=nl() imos_l=[0]*(N+1)...
[["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 0, 656, 0, 596, 141, 704, 141, 673, 0, 22], ["-", 36, 36, 0, 656, 0, 596, 141, 704, 0, 272], ["-", 36, 36, 0, 656, 0, 596, 141, 704, 705, 22], ["-", 8, 196, 0, 57, 15, 23, 0, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 0, 22]]
5
273
import sys input = sys.stdin.readline def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) for i in range(K): b = [0] * (N+1) for j in range(N): a = A[j] b[max(j-a, 0)] += 1 b[min(j+a+1, N)] -= 1 for k in range(1,N+1): ...
import sys input = sys.stdin.readline def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) for i in range(K): b = [0] * (N+1) for j in range(N): a = A[j] b[max(j-a, 0)] += 1 b[min(j+a+1, N)] -= 1 for k in range(1,N+1): ...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
168
n,k=map(int,input().split()) a=list(map(int,input().split())) for j in range(41): b=[0]*n for i in range(0,n): l=max(0,i-a[i]) r=min(n-1,i+a[i]) b[l]+=1 if(r+1<n): b[r+1]-=1 for i in range(1,n,1): b[i]+=b[i-1] if a==b: break a=b print(' ...
n,k=map(int,input().split()) a=list(map(int,input().split())) for j in range(k): b=[0]*n for i in range(0,n): l=max(0,i-a[i]) r=min(n-1,i+a[i]) b[l]+=1 if(r+1<n): b[r+1]-=1 for i in range(1,n,1): b[i]+=b[i-1] if a==b: break a=b print(' '...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
157
package main import ( "bufio" "os" "strconv" "strings" "fmt" ) func Solve() { var N, K int var A []int NextInt(&N, &K) NextIntVec(&A) B := make([][]int, 2) for i := range B { B[i] = make([]int, N + 1) } for i, a := range A { B[0][i] = a } for k := 0; k < K; k++ { i := k % 2 for j := r...
package main import ( "bufio" "os" "strconv" "strings" "fmt" ) func Solve() { var N, K int var A []int NextInt(&N, &K) NextIntVec(&A) B := make([][]int, 2) for i := range B { B[i] = make([]int, N + 1) } for i, a := range A { B[0][i] = a } for k := 0; k < K; k++ { i := k % 2 for j := r...
[["-", 3, 4, 0, 464, 0, 437, 71, 16, 31, 433], ["-", 3, 4, 0, 464, 0, 437, 71, 16, 17, 33]]
7
859
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vl = vector<ll>; using vvl = vector<vl>; using vb = vector<bool>; using P = pair<ll, ll>; template <typename T> using pq = priority_queue<T>; template <typename T> using minpq = priority_queue<T, vector<T>, greater<T>>; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vl = vector<ll>; using vvl = vector<vl>; using vb = vector<bool>; using P = pair<ll, ll>; template <typename T> using pq = priority_queue<T>; template <typename T> using minpq = priority_queue<T, vector<T>, greater<T>>; ...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
590
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < min(k, 50); i++) { vector<int> imos(n); // I'll begin the imos method for (int j = 0; j < n; j++) { int l = max(0, j - a[...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < min(k, 50); i++) { vector<int> imos(n); // I'll begin the imos method for (int j = 0; j < n; j++) { int l = max(0, j - a[...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
247
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, a, n) for (ll i = a; i < n; i++) #define rev(i, n, a) for (ll i = n - 1; i >= a; i--) #define f first #define s second #define vll vector<ll> #define vvll vector<vector<ll>> #define vpii vector<pair<int, int>> #define vpll vector<pll> #d...
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, a, n) for (ll i = a; i < n; i++) #define rev(i, n, a) for (ll i = n - 1; i >= a; i--) #define f first #define s second #define vll vector<ll> #define vvll vector<vector<ll>> #define vpii vector<pair<int, int>> #define vpll vector<pll> #d...
[["-", 49, 50, 51, 2, 3, 4, 0, 2, 63, 22], ["-", 51, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 51, 2, 3, 4, 0, 74, 39, 77, 39, 78], ["+", 49, 50, 51, 2, 3, 4, 0, 74, 51, 13], ["-", 49, 50, 51, 2, 3, 4, 0, 2, 63, 40]]
1
380
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; const ll MOD = 1000000007; const double pi = acos(-1); int main() { ll N, K; cin >> N >> K; vector<ll> A(N); rep(i, N) { cin >> A.at(i); } rep(i, min(K, (ll)100)) { v...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; const ll MOD = 1000000007; const double pi = acos(-1); int main() { ll N, K; cin >> N >> K; vector<ll> A(N); rep(i, N) { cin >> A.at(i); } rep(i, min(K, (ll)100)) { v...
[["-", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 28, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 28, 2, 3, 4, 0, 16, 31, 16, 31, 22]]
1
281
#include <bits/stdc++.h> #define db(x) cout << (x) << '\n'; #define all(v) (v).begin(), (v).end() #define allr(v) (v).rbegin(), (v).rend() #define f first #define s second using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pii; typedef pair<double, ll> pdi; typedef pair<ld, ld> pdd;...
#include <bits/stdc++.h> #define db(x) cout << (x) << '\n'; #define all(v) (v).begin(), (v).end() #define allr(v) (v).rbegin(), (v).rend() #define f first #define s second using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pii; typedef pair<double, ll> pdi; typedef pair<ld, ld> pdd;...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
555
#include <algorithm> #include <cassert> #include <cmath> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include...
[["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
2,557
<?php [$N, $K] = ints(); $A = ints(); for($j = 0; $j < min(50, $K); $j++){ $B = array_fill(0, $N+1, 0); foreach($A as $i => $a){ $B[max($i-$a,0)]++; $B[min($i+$a+1,$N)]--; } for($i = 0; $i < $N; $i++){ $A[$i] = ($A[$i-1]??0) + $B[$i]; } o($B); } echo implode(" ", $A); function str(){return tri...
<?php [$N, $K] = ints(); $A = ints(); for($j = 0; $j < min(50, $K); $j++){ $B = array_fill(0, $N+1, 0); foreach($A as $i => $a){ $B[max($i-$a,0)]++; $B[min($i+$a+1,$N)]--; } for($i = 0; $i < $N; $i++){ $A[$i] = ($A[$i-1]??0) + $B[$i]; } } echo implode(" ", $A); function str(){return trim(fgets(S...
[["-", 0, 7, 0, 9, 0, 1, 0, 613, 63, 141], ["-", 0, 9, 0, 1, 0, 613, 3, 3, 0, 24], ["-", 0, 613, 3, 3, 0, 28, 0, 606, 0, 607], ["-", 0, 613, 3, 3, 0, 28, 0, 606, 0, 141], ["-", 0, 9, 0, 1, 0, 613, 3, 3, 0, 25], ["-", 0, 493, 0, 7, 0, 9, 0, 1, 0, 35]]
6
1,411
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++) #define all(v) v.begin(), v.end() // c int main() { int n, k; cin >> n >> k; vector<vector<int>> a(n, vector<int>(51)); rep(i, n) cin >> a[0][i]; rep(i, k) { vector<int> memo(n + 1); rep(j, n...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++) #define all(v) v.begin(), v.end() // c int main() { int n, k; cin >> n >> k; vector<vector<int>> a(51, vector<int>(n)); rep(i, n) cin >> a[0][i]; rep(i, k) { vector<int> memo(n + 1); rep(j, n...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 22]]
1
290
#include <bits/stdc++.h> int main(void) { // Your code here! int N, K; std::cin >> N >> K; std::vector<int> A(N); for (int i = 0; i < N; ++i) std::cin >> A.at(i); for (int i = 0; i < K; ++i) { // sousa std::vector<int> next(N + 1); for (int j = 0; j < N; ++j) { int left = std::clamp(...
#include <bits/stdc++.h> int main(void) { // Your code here! int N, K; std::cin >> N >> K; std::vector<int> A(N); for (int i = 0; i < N; ++i) std::cin >> A.at(i); for (int i = 0; i < K; ++i) { // sousa std::vector<int> next(N + 1); for (int j = 0; j < N; ++j) { int left = std::clamp(...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 60], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
278
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) int main() { ll n, k; cin >> n >> k; vector<ll> a(n); rep(i, n) { cin >> a[i]; } rep(j, 50) { vector<ll> v(n + 1, 0); rep(i, n) { v[max(0LL, i - a[i])]++; v[min(n, i + a...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) int main() { ll n, k; cin >> n >> k; vector<ll> a(n); rep(i, n) { cin >> a[i]; } rep(j, min(50LL, k)) { vector<ll> v(n + 1, 0); rep(i, n) { v[max(0LL, i - a[i])]++; v[mi...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
183
from itertools import accumulate def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) for _ in range(K): arr = [0]*(N+1) for i, a in enumerate(A): left = max(0, i-a) right = min(N, i+a+1) arr[left] += 1 arr[right] ...
from itertools import accumulate def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) for _ in range(K): arr = [0]*(N+1) for i, a in enumerate(A): left = max(0, i-a) right = min(N, i+a+1) arr[left] += 1 arr[right] ...
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 102], ["-", 3, 4, 0, 206, 206, 663, 0, 664, 17, 33], ["-", 3, 4, 0, 206, 206, 663, 0, 664, 28, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73]]
5
158
n,k=map(int,input().split()) A=list(map(int,input().split())) def culc(L): subL=[0]*(n+1) for i in range(n): temp=L[i] bottom=max(i-temp,0) top=min(i+temp,n-1) subL[bottom]+=1 subL[top+1]-=1 resL=[0]*n resL[0]=subL[0] for i in range(1,n): resL[...
n,k=map(int,input().split()) A=list(map(int,input().split())) def culc(L): subL=[0]*(n+1) for i in range(n): temp=L[i] bottom=max(i-temp,0) top=min(i+temp,n-1) subL[bottom]+=1 subL[top+1]-=1 resL=[0]*n resL[0]=subL[0] for i in range(1,n): resL[...
[["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]]
5
167
#include <algorithm> #include <cstring> #include <iomanip> #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++) #define ALL(v) v.begin(), v.end() using namespace std; using ll = long long...
#include <algorithm> #include <cstring> #include <iomanip> #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++) #define ALL(v) v.begin(), v.end() using namespace std; using ll = long long...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 57, 15, 339, 51, 16, 12, 2, 63, 22], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 24], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 22], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
373
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> av(n); for (auto &a : av) { cin >> a; } for (int ki = 0; ki < k; ++ki) { vector<int> bv(n + 1); for (int i = 0; i < n; ++i) { int l = max(0, i - av[i]); ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> av(n); for (auto &a : av) { cin >> a; } for (int ki = 0; ki < k; ++ki) { vector<int> bv(n + 1, 0); for (int i = 0; i < n; ++i) { int l = max(0, i - av[i]); ...
[["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
211
import sys # import re import math import collections # import decimal import bisect import itertools import fractions # import functools import copy import heapq import decimal # import statistics import queue # import numpy as np sys.setrecursionlimit(10000001) INF = 10 ** 16 MOD = 10 ** 9 + 7 # MOD = 998244353 ni...
import sys # import re import math import collections # import decimal import bisect import itertools import fractions # import functools import copy import heapq import decimal # import statistics import queue # import numpy as np sys.setrecursionlimit(10000001) INF = 10 ** 16 MOD = 10 ** 9 + 7 # MOD = 998244353 ni...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
238
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int K = scan.nextInt(); int[] A = new int[N]; int[] B; for (int i = 0; i < N; i++) { A[i] = scan.nextInt(); } scan.close(); ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int K = scan.nextInt(); int[] A = new int[N]; int[] B; for (int i = 0; i < N; i++) { A[i] = scan.nextInt(); } scan.close(); ...
[["-", 8, 196, 0, 52, 15, 15, 0, 16, 17, 60], ["+", 8, 196, 0, 52, 15, 15, 0, 16, 17, 47], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 12, 499], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 12, 499]]
3
352
n, k = map(int, input().split()) a = list(map(int, input().split())) for _ in range(min(50, k)): l = [0]*(n+1) for i in range(n): l[max(i-a[i], 0)] += 1 #光の届く距離(後ろ) l[min(i+a[i]+1, n)] -= 1 #光が届かなくなる距離(前) print(l) add = 0 for i in range(n): add += l[i] #光の届いている電球の数を累積 ...
n, k = map(int, input().split()) a = list(map(int, input().split())) for _ in range(min(50, k)): l = [0]*(n+1) for i in range(n): l[max(i-a[i], 0)] += 1 #光の届く距離(後ろ) l[min(i+a[i]+1, n)] -= 1 #光が届かなくなる距離(前) add = 0 for i in range(n): add += l[i] #光の届いている電球の数を累積 a[i] = add ...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
134
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() #define PRINT(a) cout << (a) << endl #define RALL(v) rbegin(v), rend(v) #define pb push_back #define eb emplace_back #define mp make_pair #define Fi f...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() #define PRINT(a) cout << (a) << endl #define RALL(v) rbegin(v), rend(v) #define pb push_back #define eb emplace_back #define mp make_pair #define Fi f...
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["-", 51, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 51, 2, 3, 4, 0, 16, 31, 16, 31, 22]]
1
463
#include <algorithm> #include <bitset> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, P> P1; typedef pair<P, P> P2; #define pu ...
#include <algorithm> #include <bitset> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, P> P1; typedef pair<P, P> P2; #define pu ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
360
#include <bits/stdc++.h> using namespace std; // input #define INIT \ std::ios::sync_with_stdio(false); \ std::cin.tie(0); #define VAR(type, ...) \ ...
#include <bits/stdc++.h> using namespace std; // input #define INIT \ std::ios::sync_with_stdio(false); \ std::cin.tie(0); #define VAR(type, ...) \ ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
1,708
n,k,*l=map(int,open(0).read().split()) for _ in range(min(k,99)): s=[0]*(n+1) for i in range(n): s[max(i-l[i],0)]+=1 s[min(i+l[i]+1,n)]-=1 l[0]=min(s[0],n) for i in range(1,n): l[i]=min(l[i-1]+s[i],n) print(l)
n,k,*l=map(int,open(0).read().split()) for _ in range(min(k,41)): s=[0]*(n+1) for i in range(n): s[max(i-l[i],0)]+=1 s[min(i+l[i]+1,n)]-=1 l[0]=min(s[0],n) for i in range(1,n): l[i]=min(l[i-1]+s[i],n) print(*l)
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]]
5
139
#include <bits/stdc++.h> #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define repb(i, n) for (ll i = (n)-1; i >= 0; i--) #define rep(i, n) repd(i, 0, n) using namespace std; using ll = long long; using ul = unsigned long long; using ld = long double; ll mod = 1000000007; int main() { ll n, k; cin >> n >...
#include <bits/stdc++.h> #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define repb(i, n) for (ll i = (n)-1; i >= 0; i--) #define rep(i, n) repd(i, 0, n) using namespace std; using ll = long long; using ul = unsigned long long; using ld = long double; ll mod = 1000000007; int main() { ll n, k; cin >> n >...
[["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
265
N, K = map(int, input().split()) A = list(map(int, input().split())) # imos法して,もう一回同じことを行う # K回のシミューレション,途中で全てがKになったら打ち切る for _ in range(K): new = [0] * N imos = [0] * N for i, a in enumerate(A): # 0-indexにしても問題ない imos[max(0, i-a)] += 1 if i+a+1 <= N-1: # 右端まで照らすなら,終端は管理しない im...
N, K = map(int, input().split()) A = list(map(int, input().split())) # imos法して,もう一回同じことを行う # K回のシミューレション,途中で全てがKになったら打ち切る for _ in range(K): new = [0] * N imos = [0] * N for i, a in enumerate(A): # 0-indexにしても問題ない imos[max(0, i-a)] += 1 if i+a+1 <= N-1: # 右端まで照らすなら,終端は管理しない im...
[["+", 8, 196, 0, 1, 0, 662, 31, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 662, 31, 206, 0, 73]]
5
144
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long #define all(x) (x).begin(), (x).end() template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> bool ...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long #define all(x) (x).begin(), (x).end() template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> bool ...
[["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 147], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 146], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 147]]
1
470
#include <bits/stdc++.h> #include <string.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int INF = 1001001001; int main() { int n, k; cin >> n >> k; vector<ll> a(n); rep(i, n) cin >> a[i]; rep(i, k) { vector<ll> memo(n +...
#include <bits/stdc++.h> #include <string.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int INF = 1001001001; int main() { int n, k; cin >> n >> k; vector<ll> a(n); rep(i, n) cin >> a[i]; rep(i, k) { vector<ll> memo(n +...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 107]]
1
216
#include <algorithm> #include <cstdio> #include <cstring> #define ll long long using namespace std; const int N = 202202; ll f[N], sum[N]; int n, k; int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) scanf("%lld", &f[i]); while (--k) { for (int i = 1; i <= n; i++) sum[max(1ll, i - f[i]...
#include <algorithm> #include <cstdio> #include <cstring> #define ll long long using namespace std; const int N = 202202; ll f[N], sum[N]; int n, k; int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) scanf("%lld", &f[i]); while (k--) { for (int i = 1; i <= n; i++) sum[max(1ll, i - f[i]...
[["-", 8, 9, 0, 52, 15, 339, 51, 27, 17, 68], ["+", 8, 9, 0, 52, 15, 339, 51, 27, 17, 68]]
1
262
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, k; cin >> n >> k; vector<int> a(n); rep(i, n) cin >> a[i]; rep(j, k) { vector<int> b(n + 1); rep(i, n) { int l, r; l = max(0, i - a[i]); r =...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, k; cin >> n >> k; vector<int> a(n); rep(i, n) cin >> a[i]; rep(j, k) { vector<int> b(n + 1); rep(i, n) { int l, r; l = max(0, i - a[i]); r =...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
211
N,K = map(int,input().split()) A = list(map(int,input().split())) def s(n,a): b = [0]*n for i in range(n): l = max(0,i-a[i]) r = min(n-1,i+a[i]) b[l] += 1 if r < n - 1: b[r+1] -= 1 for i in range(n): b[i+1] = b[i] return b for i in range(min(41,K)): A = s(N,A) print(A)
N,K = map(int,input().split()) A = list(map(int,input().split())) def s(n,a): b = [0]*n for i in range(n): l = max(0,i-a[i]) r = min(n-1,i+a[i]) b[l] += 1 if r < n - 1: b[r+1] -= 1 for i in range(n-1): b[i+1] += b[i] return b for i in range(min(41,K)): A = s(N,A) print(*A) ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]]
5
151
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; ll a[212345], b[212345]; int main() { ll n, k; cin >> n >> k; for (int i = 0; i < n; i++) { cin >> a[i]; } if (pow(2, k + 3) > n) { for (int i = 0; i < n; i++) { cout << n << " "; } return ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; ll a[212345], b[212345]; int main() { ll n, k; cin >> n >> k; for (int i = 0; i < n; i++) { cin >> a[i]; } if (pow(2, k - 50) > n) { for (int i = 0; i < n; i++) { cout << n << " "; } return...
[["-", 51, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["-", 51, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16, 31, 2,...
1
273
#include <bits/stdc++.h> using namespace std; const int MAXN = 200001; int n, m; int prev1[MAXN]; int cur[MAXN]; priority_queue<int> pqr; priority_queue<int, vector<int>, std::greater<int>> pql; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int k = 1; k <= n; k++) { cin >> ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 200001; int n, m; int prev1[MAXN]; int cur[MAXN]; priority_queue<int> pql; priority_queue<int, vector<int>, std::greater<int>> pqr; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int k = 1; k <= n; k++) { cin >> ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
374