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 <stdio.h> struct ball { int num; bool flag; } box[100010]; int main() { int n, m, i, x, y, num = 0; scanf("%d %d", &n, &m); box[1].num = 1; box[1].flag = true; for (i = 2; i <= n; i++) { box[i].num = 1; box[i].flag = false; } for (i = 0; i < m; i++) { scanf("%d %d", &x, &y); ...
#include <stdio.h> struct ball { int num; bool flag; } box[100010]; int main() { int n, m, i, x, y, num = 0; scanf("%d %d", &n, &m); box[1].num = 1; box[1].flag = true; for (i = 2; i <= n; i++) { box[i].num = 1; box[i].flag = false; } for (i = 0; i < m; i++) { scanf("%d %d", &x, &y); ...
[["+", 15, 339, 51, 16, 31, 118, 28, 69, 28, 22], ["+", 51, 16, 31, 118, 28, 69, 341, 342, 0, 70], ["+", 51, 16, 31, 118, 28, 69, 341, 342, 0, 73], ["+", 0, 57, 15, 339, 51, 16, 31, 118, 17, 131], ["+", 0, 57, 15, 339, 51, 16, 31, 118, 119, 120], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, ...
1
232
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a, b; int A[100005]; int color[100005]; for (int i = 0; i < 100005; i++) { A[i] = 1; color[i] = 0; } scanf("%d %d", &n, &m); color[1] = 1; for (int i = 0; i < m; i++) { scanf("%d %d", &a, &b); if (A[a] > 0) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a, b; int A[100005]; int color[100005]; for (int i = 0; i < 100005; i++) { A[i] = 1; color[i] = 0; } scanf("%d %d", &n, &m); color[1] = 1; for (int i = 0; i < m; i++) { scanf("%d %d", &a, &b); if (A[a] > 0) { ...
[["+", 64, 9, 0, 1, 0, 11, 12, 41, 0, 101], ["+", 64, 9, 0, 1, 0, 11, 12, 41, 64, 13], ["+", 64, 9, 0, 1, 0, 11, 12, 41, 0, 102], ["+", 0, 1, 0, 11, 12, 41, 75, 69, 28, 22], ["+", 0, 11, 12, 41, 75, 69, 341, 342, 0, 70], ["+", 0, 11, 12, 41, 75, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 41, 75, 69, 341, 342, 0, 73], ["+",...
1
198
#include <cstdio> #include <cstring> #include <iostream> using namespace std; #define MAXN 100000 bool red[MAXN + 5]; int count[MAXN + 5]; int main() { int n, m, cnt = 0; scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) count[i] = 1; red[1] = 1; for (int i = 1; i <= m; i++) { int a, b; scanf("%...
#include <cstdio> #include <cstring> #include <iostream> using namespace std; #define MAXN 100000 bool red[MAXN + 5]; int count[MAXN + 5]; int main() { int n, m, cnt = 0; scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) count[i] = 1; red[1] = 1; for (int i = 1; i <= m; i++) { int a, b; scanf("%...
[["+", 15, 339, 51, 16, 31, 16, 31, 69, 28, 22], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 1...
1
203
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vector<int>>; using vvvi = vector<vector<vector<int>>>; using vl = vector<ll>; using vvl = vector<vector<ll>>; using vvvl = vector<vector<vector<ll>>>; using vs = vector<string>; using...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vector<int>>; using vvvi = vector<vector<vector<int>>>; using vl = vector<ll>; using vvl = vector<vector<ll>>; using vvvl = vector<vector<vector<ll>>>; using vs = vector<string>; using...
[["+", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 6...
1
621
n,m=map(int,input().split()) a=[1]*(n+1) b=[0]*(n+1) b[1]=1 for _ in range(m): x,y=map(int,input().split()) a[x]-=1 a[y]+=1 if b[x]:b[y]=1 ans=0 for i,j in zip(a,b): ans+=(i!=0)*j print(ans)
n,m=map(int,input().split()) a=[1]*(n+1) b=[0]*(n+1) b[1]=1 for _ in range(m): x,y=map(int,input().split()) a[x]-=1 a[y]+=1 if b[x]:b[y]=1 if a[x]==0:b[x]=0 ans=0 for i,j in zip(a,b): ans+=(i!=0)*j print(ans)
[["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612...
5
120
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(void) { int N, M; cin >> N >> M; vector<int> x(M), y(M); for (int i = 0; i < M; i++) { int x_in, y_in; cin >> x_in >> y_in; x[i] = x_in - 1; y[i] = y_in - 1; } vector<int> white(N, 1); white[0] = 0; vector<in...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(void) { int N, M; cin >> N >> M; vector<int> x(M), y(M); for (int i = 0; i < M; i++) { int x_in, y_in; cin >> x_in >> y_in; x[i] = x_in - 1; y[i] = y_in - 1; } vector<int> all(N, 1); vector<int> red(N, 0); re...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 14, 8,...
1
250
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> cnt(N, 1); vector<bool> exist(N, false); exist[0] = true; for (int i = 0; i < M; i++) { int x, y; cin >> x >> y; x--; y--; exist[y] = exist[x]; cnt[x]--; cnt[y]++; if (cnt[x] == ...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> cnt(N, 1); vector<bool> exist(N, false); exist[0] = true; for (int i = 0; i < M; i++) { int x, y; cin >> x >> y; x--; y--; if (exist[x]) exist[y] = true; cnt[x]--; cnt[y]++; ...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 1...
1
155
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <tuple> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (n); i++...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <tuple> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (n); i++...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 146], ["-", 8, 9, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, ...
1
387
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr long long MOD = 1000000007; constexpr long long INF = 1LL << 60; const long double PI = acosl(-1.0); constexpr long double EPS = 1e-11; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return ...
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr long long MOD = 1000000007; constexpr long long INF = 1LL << 60; const long double PI = acosl(-1.0); constexpr long double EPS = 1e-11; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return ...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 27, 28, 69, 341, 342, 0, 69, 28, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["+",...
1
367
/////////////////////////////////////////////////////////////////////////////// #include <bits/stdc++.h> #include <sys/time.h> #include <time.h> #include <unistd.h> using namespace std; /////////////////////////////////////////////////////////////////////////////// #define DEBUG 0 #define pb push_back #define V ve...
/////////////////////////////////////////////////////////////////////////////// #include <bits/stdc++.h> #include <sys/time.h> #include <time.h> #include <unistd.h> using namespace std; /////////////////////////////////////////////////////////////////////////////// #define DEBUG 0 #define pb push_back #define V ve...
[["+", 8, 9, 0, 338, 8, 9, 0, 57, 0, 121], ["+", 0, 338, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 0, 338, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 338, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 64,...
1
1,319
#include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; // cin>>t; while (t--) { int n, m; cin >> n >> m; int a[n + 1]; int b[n + 1]; memset(b, 0, sizeof(b)); b[1] =...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; // cin>>t; while (t--) { int n, m; cin >> n >> m; int a[n + 1]; int b[n + 1]; memset(b, 0, sizeof(b)); b[1] =...
[["-", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["-", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 17...
1
249
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; const long long INF = 1LL << 60; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; const long long INF = 1LL << 60; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 147], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 8, 9, 0,...
1
343
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define pp pair<int, int> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define ld long double #define al(a) (a).begin(), (a).end() #define mk make_pair #define check cout << "?" << endl; ll MOD = 1000000007; ll mod = 9...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define pp pair<int, int> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define ld long double #define al(a) (a).begin(), (a).end() #define mk make_pair #define check cout << "?" << endl; ll MOD = 1000000007; ll mod = 9...
[["+", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 6...
1
193
n, m = map(int,input().split()) b_list = [] for i in range(m): x = [] x = list(map(int,input().split())) b_list.append(x) ans_list = [0 for i in range(10**5)] ans_list[0] = 1 ball_list = [1 for i in range(10**5)] print(ball_list[0]) for tmp in b_list: x, y = tmp[0], tmp[1] print(x, y) if ans_...
n, m = map(int,input().split()) b_list = [] for i in range(m): x = [] x = list(map(int,input().split())) b_list.append(x) ans_list = [0 for i in range(10**5)] ans_list[0] = 1 ball_list = [1 for i in range(10**5)] for tmp in b_list: x, y = tmp[0], tmp[1] if ans_list[x-1] == 1 and ans_list[y-1] == ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 7, 8, 196...
5
201
from sys import stdin def main(): input = lambda: stdin.readline()[:-1] N, M = map(int, input().split()) XY = [tuple(map(int, input().split())) for _ in [0] * M] box = [1] * (N + 1) red = [0] * (N + 1) box[0], red[1] = 0, 1 for x, y in XY: box[x] -= 1 box[y] += 1 r...
from sys import stdin def main(): input = lambda: stdin.readline()[:-1] N, M = map(int, input().split()) XY = [tuple(map(int, input().split())) for _ in [0] * M] box = [1] * (N + 1) red = [0] * (N + 1) box[0], red[1] = 0, 1 for x, y in XY: box[x] -= 1 box[y] += 1 i...
[["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 206, 206, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 102], ["-", 8, 196, 0, 1, 0, 662, 12, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 206, 22], [...
5
152
#include <bits/stdc++.h> #include <cctype> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) (v).begin(), (v).end() typedef long long int ll; #define pi 3.1415926535897932384 #define E9 1000000000 #define eps 1e-4 #define pii pair<int, int> int main() { int N, M; cin >> N >> M; ...
#include <bits/stdc++.h> #include <cctype> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) (v).begin(), (v).end() typedef long long int ll; #define pi 3.1415926535897932384 #define E9 1000000000 #define eps 1e-4 #define pii pair<int, int> int main() { int N, M; cin >> N >> M; ...
[["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 22], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 106], ["+", 0, 11, 12, 23, 0, 16, 12, 69, 28, 22], ["+", 12, 23, 0, 16, 12, 69, 341, 342, 0, 70], ["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 25]]
1
181
#include <bits/stdc++.h> using namespace std; int vst[10010]; int num[10010]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N, M; cin >> N >> M; int ans = 1; vst[1] = 1; fill(num, num + N + 1, 1); while (M--) { int x, y; cin >> x >> y; num[x]--; num[y]++; if (...
#include <bits/stdc++.h> using namespace std; int vst[100010]; int num[100010]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N, M; cin >> N >> M; int ans = 1; vst[1] = 1; fill(num, num + N + 1, 1); while (M--) { int x, y; cin >> x >> y; num[x]--; num[y]++; if...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 64, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0...
1
151
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { int n, m; cin >> n >> m; vector<int> a(n, 1); vector<bool> ok(n, false); ok[0] = true; rep(i, m) { int x, y; cin >> x >> y; x--; y--; if (ok[x]) { a[x]-...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { int n, m; cin >> n >> m; vector<int> a(n, 1); vector<bool> ok(n, false); ok[0] = true; rep(i, m) { int x, y; cin >> x >> y; x--; y--; a[x]--; a[y]++; ...
[["-", 8, 9, 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, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 73], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-...
1
166
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { int n, m; cin >> n >> m; vector<int> a(n, 1); vector<bool> ok(n, false); ok[0] = true; rep(i, m) { int x, y; cin >> x >> y; x--; y--; if (ok[x]) { a[x]-...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { int n, m; cin >> n >> m; vector<int> a(n, 1); vector<bool> ok(n, false); ok[0] = true; rep(i, m) { int x, y; cin >> x >> y; x--; y--; a[x]--; a[y]++; ...
[["-", 8, 9, 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, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 73], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-...
1
166
#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>; const int INF = 1000000007; int main() { int n, m; cin >> n >> m; int num[n]; rep(i, n) num[i] = 1; bool red[n]; red[0] = true; rep(i, m) { int x, y; cin >...
#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>; const int INF = 1000000007; int main() { int n, m; cin >> n >> m; int num[n]; bool red[n]; rep(i, n) { num[i] = 1; red[i] = false; } red[0] = true; rep(i...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 70], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 73], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 14, 8, 9, 0, 45], ["-", 0, 30, 0, 14, 8, 9, ...
1
181
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n; i++) #define ll long long #define INF 21474836...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n; i++) #define ll long long #define INF 21474836...
[["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35]]
1
246
n,m=map(int,input().split()) b=[1]*n red=[False]*n red[0]=True for i in range(m): x,y=map(int,input().split()) x,y=x-1,y-1 if not b[x]: continue b[y]+=1 red[y]=red[x] b[x]-=1 if b[x]==0: red[x]=False print(red.count(True))
n,m=map(int,input().split()) b=[1]*n red=[False]*n red[0]=True for i in range(m): x,y=map(int,input().split()) x,y=x-1,y-1 if not b[x]: continue b[y]+=1 if red[x]: red[y]=True b[x]-=1 if b[x]==0: red[x]=False print(red.count(True))
[["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 206, 206, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["-", 8, 196, 0, 1, 0, 662, 12, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 206, 22], [...
5
123
# -*- coding: utf-8 -*- """ Created on Sun Jun 7 14:28:00 2020 @author: NEC-PCuser """ N, M = map(int, input().split()) x, y = [], [] for i in range(M): x_tmp, y_tmp = map(int, input().split()) x.append(x_tmp) y.append(y_tmp) box = [1] * N ball_set = set() ball_set.add(1) start_flg = True for i in ran...
# -*- coding: utf-8 -*- """ Created on Sun Jun 7 14:28:00 2020 @author: NEC-PCuser """ N, M = map(int, input().split()) x, y = [], [] for i in range(M): x_tmp, y_tmp = map(int, input().split()) x.append(x_tmp) y.append(y_tmp) box = [1] * N ball_set = set() ball_set.add(1) start_flg = True for i in ran...
[["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 267], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102...
5
157
import numpy as np n,m = [int(i)for i in input().split()] l = [[int(i)-1 for i in input().split()] for _ in range(m)] line = np.array([1 for _ in range(n)]) is_red = np.zeros(n,dtype = np.int32) is_red[0] = 1 for x,y in l: line[x] -= 1 if line[x] > 0 else 0 line[y] += 1 is_red[y] = 1 if is_red[x] == 1...
import numpy as np n,m = [int(i)for i in input().split()] l = [[int(i)-1 for i in input().split()] for _ in range(m)] line = np.array([1 for _ in range(n)]) is_red = np.zeros(n,dtype = np.int32) is_red[0] = 1 for x,y in l: line[x] -= 1 if line[x] > 0 else 0 line[y] += 1 is_red[y] = 1 if is_red[x] == 1...
[["+", 8, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["+", 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], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 1, 0, 662, 12, 41, 0, 206, 51, 22], ["+", 0, 1, 0, 662, 12, 41, 0, 206, 0, 70], ["+",...
5
162
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() #define each(it, c) ...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() #define each(it, c) ...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17...
1
383
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; int start = 1; int x, y; vector<int> count(N + 1, 1); vector<int> possible(N + 1, 0); possible[1] = 1; for (int i = 0; i < M; ++i) { cin >> x >> y; count[x] -=...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; int x, y; vector<int> count(N + 1, 1); vector<int> possible(N + 1, 0); possible[1] = 1; for (int i = 0; i < M; ++i) { cin >> x >> y; count[x] -= 1; count[y] ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 33...
1
191
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m, x, y; cin >> n >> m; int a[n]; int b[n]; for (int i = 0; i < n; ++i) { a[i] = 1; b[i] = 0; } b[0] = 1; for (int i = 0; i < m; ++i) { cin >> x >> y; if (b[x - 1] > 0) { if (a[x - 1] > 1) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m, x, y; cin >> n >> m; int a[n]; int b[n]; for (int i = 0; i < n; ++i) { a[i] = 1; b[i] = 0; } b[0] = 1; for (int i = 0; i < m; ++i) { cin >> x >> y; if (b[x - 1] > 0) { if (a[x - 1] > 1) { ...
[["+", 64, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 31, 22], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 31, 69, 341, 342, 0, 16,...
1
251
/* * Created by KeigoOgawa */ #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #define INF (int)1e8 #define EPS 1e-10 #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); ...
/* * Created by KeigoOgawa */ #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #define INF (int)1e8 #define EPS 1e-10 #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); ...
[["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 14, 8, ...
1
291
#include <bits/stdc++.h> using namespace std; int main(void) { int N, M; cin >> N >> M; set<int> st; vector<int> cnt(N + 1, 1); for (int i = 0; i < M; i++) { int x, y; cin >> x >> y; cnt[x]--; cnt[y]++; if (st.find(x) != st.end() || i == 0) st.insert(y); } int ans = 0; for (a...
#include <bits/stdc++.h> using namespace std; int main(void) { int N, M; cin >> N >> M; set<int> st; st.insert(1); vector<int> cnt(N + 1, 1); for (int i = 0; i < M; i++) { int x, y; cin >> x >> y; cnt[x]--; cnt[y]++; if (st.find(x) != st.end()) { st.insert(y); } if (cnt[x...
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 15, 339, 51, 16, ...
1
159
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef double DB; #define F(i, a, b) for (int i = (a); i <= (b); ++i) #define R(i, n) for (int i = 0; i < (n); ++i) #define fill(a, b) memset(a, b, sizeof a) const int maxn = 1e5 + 10; int ball[maxn], yes[maxn], x[maxn], y[maxn]; int n, m; int mai...
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef double DB; #define F(i, a, b) for (int i = (a); i <= (b); ++i) #define R(i, n) for (int i = 0; i < (n); ++i) #define fill(a, b) memset(a, b, sizeof a) const int maxn = 1e5 + 10; int ball[maxn], yes[maxn], x[maxn], y[maxn]; int n, m; int mai...
[["-", 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], ["-", 51, 16, 12, 69, 341, 342, 0, 69, 28, 22], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["-", 12, 69, 341, 342, 0, 69, 3...
1
230
#include <stdbool.h> #include <stdio.h> #define maxn 200001 bool can[maxn]; int count[maxn]; int main(void) { int n, m; scanf("%i %i", &n, &m); can[1] = true; for (int i = 1; i <= n; i++) { count[i] = 1; } while (m--) { int x, y; scanf("%i %i", &x, &y); if (can[x]) { can[y] = tru...
#include <stdbool.h> #include <stdio.h> #define maxn 200001 bool can[maxn]; int count[maxn]; int main(void) { int n, m; scanf("%i %i", &n, &m); can[1] = true; for (int i = 1; i <= n; i++) { count[i] = 1; } while (m--) { int x, y; scanf("%i %i", &x, &y); if (can[x]) { can[y] = tru...
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 0, 70], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 71, 22], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 0, 73], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1,...
0
184
#include <bits/stdc++.h> #define ll long long int #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define Max(a, b) ((a) > (b) ? (a) : (b)) #define Min(a, b) ((a) < (b) ? (a) : (b)) #define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i += 1) #define all(a) (a).begin(), ...
#include <bits/stdc++.h> #define ll long long int #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define Max(a, b) ((a) > (b) ? (a) : (b)) #define Min(a, b) ((a) < (b) ? (a) : (b)) #define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i += 1) #define all(a) (a).begin(), ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 11, 12, 16, 31, 118, 28, 69, 28, 22], ["+", 12, 16, 31, 118, 28, 69, 341, 342, 0, 70], ["+", 12, 16, 31, 118, 28, 69, 341, 342, 0, 22], ["+", 12, 16, 31, 118, 28, 69, 341, 342, 0, 73], ["+", 0, 1, 0, 11, 12, 16, 31, 118, 17, 131], ["+...
1
316
#include <algorithm> #include <array> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <numeric> #include <queue> #include <vector> using namespace std; #define Getsign(n) ((n > 0) - (n < 0)) #define QWERTYR(c) ...
#include <algorithm> #include <array> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <numeric> #include <queue> #include <vector> using namespace std; #define Getsign(n) ((n > 0) - (n < 0)) #define QWERTYR(c) ...
[["+", 0, 7, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 11, 12, 2, 3, 4, ...
1
255
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define FOR...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define FOR...
[["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["-", 8, 9, 0, 57, 64...
1
727
#include "bits/stdc++.h" using namespace std; //諸機能 #pragma region MACRO #define putans(x) \ cerr << "answer: "; \ cout << (x) << endl #define dputans(x) ...
#include "bits/stdc++.h" using namespace std; //諸機能 #pragma region MACRO #define putans(x) \ cerr << "answer: "; \ cout << (x) << endl #define dputans(x) ...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["-", 15, ...
1
421
// Daniel Grzegorzewski #include <bits/stdc++.h> #define MP make_pair #define PB push_back #define ST first #define ND second using namespace std; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VII; typedef long long LL; void init_ios() { ios_base::sync_with_stdio(0); cin.tie(0); } con...
// Daniel Grzegorzewski #include <bits/stdc++.h> #define MP make_pair #define PB push_back #define ST first #define ND second using namespace std; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VII; typedef long long LL; void init_ios() { ios_base::sync_with_stdio(0); cin.tie(0); } con...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["-", 0, 57, 64, 9, 0...
1
221
#define M_PI 3.14159265358979323846 //#define _GLIBCXX_DEBUG //#define all(x) (x).begin(),(x).end() #include <bits/stdc++.h> #define TASK "" #define sqr(x) ((x) * (x)) typedef int ll; typedef long double ld; typedef unsigned long long ull; using namespace std; const ll INFLL = numeric_limits<int>::max(); const ll IN...
#define M_PI 3.14159265358979323846 //#define _GLIBCXX_DEBUG //#define all(x) (x).begin(),(x).end() #include <bits/stdc++.h> #define TASK "" #define sqr(x) ((x) * (x)) typedef int ll; typedef long double ld; typedef unsigned long long ull; using namespace std; const ll INFLL = numeric_limits<int>::max(); const ll IN...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 57, 75, 7...
1
431
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100; bool can[maxn]; int cnt[maxn]; int n, m; int main() { // freopen("./test.txt","r",stdin); scanf("%d %d", &n, &m); int now = 1; memset(can, 0, sizeof(can)); can[now] = 1; for (int i = 1; i <= n; ++i) cnt[i] = 1; for (int i =...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100; bool can[maxn]; int cnt[maxn]; int n, m; int main() { // freopen("./test.txt","r",stdin); scanf("%d %d", &n, &m); memset(can, 0, sizeof(can)); can[1] = 1; for (int i = 1; i <= n; ++i) cnt[i] = 1; for (int i = 0; i < m; ++i) ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 8, 9, 0, 57,...
1
219
#include <bits/stdc++.h> using namespace std; #define endl "\n" int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, l; cin >> n >> l; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; bool ans = false; int s = -1; for (int i = 0; i < n - 1; i++) if (a[i] + a[i + 1] >= l) ...
#include <bits/stdc++.h> using namespace std; #define endl "\n" int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, l; cin >> n >> l; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; bool ans = false; int s = -1; for (int i = 0; i < n - 1; i++) if (a[i] + a[i + 1] >= l) ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 57, 64, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 57, ...
1
192
#include <bits/stdc++.h> using namespace std; int main() { int n, L; cin >> n >> L; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int knot = -1; for (int i = 0; i < n - 1; i++) { if (a[i] + a[i + 1] >= L) { knot = i + 1; break; } } if (knot == -1) { cout << "Impo...
#include <bits/stdc++.h> using namespace std; int main() { int n, L; cin >> n >> L; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int knot = -1; for (int i = 0; i < n - 1; i++) { if (a[i] + a[i + 1] >= L) { knot = i + 1; break; } } if (knot == -1) { cout << "Impo...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["+", 0, 14, 8, 9,...
1
179
#include <algorithm> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long const int mod = 1000000007; const int MOD = 998244353; const ll INF = 10000000000...
#include <algorithm> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long const int mod = 1000000007; const int MOD = 998244353; const ll INF = 10000000000...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 5...
1
196
#include <algorithm> #include <climits> #include <cmath> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long int #define rep(i, n) fo...
#include <algorithm> #include <climits> #include <cmath> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long int #define rep(i, n) fo...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+...
1
256
#include <algorithm> #include <iostream> #include <map> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) #define dump(x) cerr << #x << " = " << (x) << endl; #define int long long signed main(void) { int N, L; cin >> N >> L; int a[N]; int maxsum = 0; int index = 0; ...
#include <algorithm> #include <iostream> #include <map> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) #define dump(x) cerr << #x << " = " << (x) << endl; #define int long long signed main(void) { int N, L; cin >> N >> L; int a[N]; int maxsum = 0; int index = 0; ...
[["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
203
<?php list($n, $l) = ints(); $a = ints(); for ($i = 0; $i < $n; ++$i) { if ($i < $n - 1 && $a[$i] + $a[$i + 1] < $l) continue; echo 'Possible', PHP_EOL; for ($j = 1; $j <= $i; ++$j) echo $j, PHP_EOL; for ($j = $n - 1; $j > $i; --$j) echo $j, PHP_EOL; exit; } echo 'Impossible', PHP_EOL; function ints...
<?php list($n, $l) = ints(); $a = ints(); for ($i = 0; $i < $n - 1; ++$i) { if ($a[$i] + $a[$i + 1] < $l) continue; echo 'Possible', PHP_EOL; for ($j = 1; $j <= $i; ++$j) echo $j, PHP_EOL; for ($j = $n - 1; $j > $i; --$j) echo $j, PHP_EOL; exit; } echo 'Impossible', PHP_EOL; function ints() { r...
[["+", 0, 493, 0, 7, 0, 16, 12, 16, 17, 33], ["+", 0, 493, 0, 7, 0, 16, 12, 16, 12, 612], ["-", 15, 23, 0, 16, 31, 16, 31, 606, 0, 607], ["-", 15, 23, 0, 16, 31, 16, 31, 606, 0, 141], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 18], ["-", 0, 16, 31, 16, 12, 16, 31, 606, 0, 607], ["-", 0, 16, 31, 16, 12, 16, 31, 606, 0, 141...
6
165
#include "bits/stdc++.h" using namespace std; using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>; using vvvvll = vector<vvvll>; constexpr ll INF = 1LL << 60; struct Fast { // cin,cout高速化のおまじない+桁数指定 Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fi...
#include "bits/stdc++.h" using namespace std; using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>; using vvvvll = vector<vvvll>; constexpr ll INF = 1LL << 60; struct Fast { // cin,cout高速化のおまじない+桁数指定 Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fi...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+...
1
3,012
#include <bits/stdc++.h> #define rint register int #define ll long long using namespace std; int n, pos, A[1010100], L; int main() { cin >> n >> L; for (rint i = 1; i <= n; ++i) cin >> A[i]; for (rint i = 1; i <= n - 1; ++i) { if (A[i] + A[i + 1] >= L) pos = i; } if (!pos) cout << "Impossibl...
#include <bits/stdc++.h> #define rint register int #define ll long long using namespace std; int n, pos, A[1010100], L; int main() { cin >> n >> L; for (rint i = 1; i <= n; ++i) cin >> A[i]; for (rint i = 1; i <= n - 1; ++i) { if (A[i] + A[i + 1] >= L) pos = i; } if (!pos) cout << "Impossibl...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 75, 76, 0, 9, 0, 7, 10, 43, 0, 35], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 31, 22], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19], ["-", 75, 76, 0, 9, 0, 7, 26, 27, 17, 29], ["+", 75, 76,...
1
171
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <typename T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define itn int #define fi fi...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <typename T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define itn int #define fi fi...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 14, 8...
1
360
package main import ( "bufio" "bytes" "fmt" "io" "os" "strconv" ) // ----------------------------------------------------------------------------- // IO helper functions // Returns next token from input. It must be initialized by SetInput() // before the key call. var nextToken func() ([]byte, error) // Outp...
package main import ( "bufio" "bytes" "fmt" "io" "os" "strconv" ) // ----------------------------------------------------------------------------- // IO helper functions // Returns next token from input. It must be initialized by SetInput() // before the key call. var nextToken func() ([]byte, error) // Outp...
[["-", 0, 7, 0, 430, 10, 431, 12, 432, 0, 433], ["+", 0, 7, 0, 430, 10, 431, 12, 432, 0, 433], ["-", 0, 7, 0, 430, 15, 16, 12, 16, 31, 22], ["-", 0, 7, 0, 430, 15, 16, 12, 16, 17, 33], ["-", 0, 7, 0, 430, 15, 16, 12, 16, 12, 433], ["+", 75, 196, 0, 7, 0, 430, 15, 16, 12, 22], ["-", 75, 196, 0, 7, 8, 196, 0, 57, 0, 121]...
7
1,156
/* Written By mafailure */ // In the name of God #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> #include <functional> // for less using namespace std; using namespace __gnu_pbds; #define IOS ...
/* Written By mafailure */ // In the name of God #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> #include <functional> // for less using namespace std; using namespace __gnu_pbds; #define IOS ...
[["+", 8, 9, 0, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["+", 8, 9, 0, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 1, 0, 16, 31, 16, 31, 2, 63, 22], ["+", 0, 1, 0, 16, 31, 16, 31, 2, 63, 22], ["+", 31, 16, 31, 2, 3, 4, 0, 1...
1
625
import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n%2==0 else 0 n,l = map(int,readline().split()) lst1 = list(map(int,readline().split())) res = -1 for i in range(n-1): if lst1[i]+lst1[i+1] >= l: res = i if res == -1: print("Impossible") exit() else: print("Possible") ...
import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n%2==0 else 0 n,l = map(int,readline().split()) lst1 = list(map(int,readline().split())) res = -1 for i in range(n-1): if lst1[i]+lst1[i+1] >= l: res = i if res == -1: print("Impossible") exit() else: print("Possible") ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
170
#include <algorithm> #include <iostream> using namespace std; int N, M; int cnt[100000]; bool in[100000]; int main() { cin >> N >> M; for (int i = 0; i < N; ++i) { cnt[i] = 1; } in[0] = true; for (int i = 0; i < M; ++i) { int a, b; cin >> a >> b; --a; --b; if (in[a]) in[b] = t...
#include <algorithm> #include <iostream> using namespace std; int N, M; int cnt[100000]; bool in[100000]; int main() { cin >> N >> M; for (int i = 0; i < N; ++i) { cnt[i] = 1; } in[0] = true; for (int i = 0; i < M; ++i) { int a, b; cin >> a >> b; --a; --b; --cnt[a]; ++cnt[b]; ...
[["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29]]
1
145
#include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; #define forsn(i, s, n) for (int i = (s); i < (int)(n); i++) #define forn(i, n) forsn(i, 0, n) #define dforsn(i, s, n)...
#include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; #define forsn(i, s, n) for (int i = (s); i < (int)(n); i++) #define forn(i, n) forsn(i, 0, n) #define dforsn(i, s, n)...
[["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 161], ["-", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57...
1
236
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = (a), i##_end_ = (b); i <= i##_end_; ++i) #define clear(a, b) memset((a), (b), sizeof(a)) typedef long long LL; int read() { int x = 0, flag = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') flag = -1; ch = ...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = (a), i##_end_ = (b); i <= i##_end_; ++i) #define clear(a, b) memset((a), (b), sizeof(a)) typedef long long LL; int read() { int x = 0, flag = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') flag = -1; ch = ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 31, 69, 341, 342, 0, 69, 28, 69, 28, 22], ["-", 341, 342, 0, 69, 28, 69, 341, 342, 0, 70], ["...
1
380
#include <algorithm> #include <cstdio> #include <deque> #include <iostream> #include <queue> #include <stack> #include <utility> #include <vector> int main(void) { const int N_MAX = 100000; int n, m; bool field[N_MAX] = {}; int amount[N_MAX]; for (int lp = 0; lp < N_MAX; lp++) { amount[lp] = 1; } fie...
#include <algorithm> #include <cstdio> #include <deque> #include <iostream> #include <queue> #include <stack> #include <utility> #include <vector> int main(void) { const int N_MAX = 100000; int n, m; bool field[N_MAX] = {}; int amount[N_MAX]; for (int lp = 0; lp < N_MAX; lp++) { amount[lp] = 1; } fie...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]...
1
201
N, M = map(int,input().split()) flags = [1] + [0]*(N-1) balls = [1]*N for i in range(M): x, y = map(int,input().split()) if flags[x-1]: flags[y-1] = 1 balls[x-1] -= 1 balls[y-1] += 1 if balls[x-1]==0: flags[x-1] = 0 print(sum(flags))
N, M = map(int,input().split()) flags = [1] + [0]*(N-1) balls = [1]*N for i in range(M): x, y = map(int,input().split()) balls[x-1] -= 1 balls[y-1] += 1 if flags[x-1]: flags[y-1] = 1 if balls[x-1]==0: flags[x-1] = 0 print(sum(flags))
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 7, 8, 196, 0, 57, 15, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 51, 22], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["-", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 612], ["-",...
5
119
#include <bits/stdc++.h> using namespace std; const long long INF = 1e7 + 1; const long long MOD = 1000000007; const long double PI = 3.1415926; #define FOR(i, r, n) for (ll i = (ll)(r); i < (ll)(n); i++) #define RFOR(i, r, n) for (ll i = (ll)(n - 1); i >= r; i--) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e7 + 1; const long long MOD = 1000000007; const long double PI = 3.1415926; #define FOR(i, r, n) for (ll i = (ll)(r); i < (ll)(n); i++) #define RFOR(i, r, n) for (ll i = (ll)(n - 1); i >= r; i--) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 8, 9, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1...
1
293
#include <bits/stdc++.h> using namespace std; const int N = 200010; int tag[N], n, x, y, m, ans, siz[N]; vector<int> v; int main() { scanf("%d%d", &n, &m); tag[1] = 1; for (int i = 1; i <= n; i++) siz[i] = 1; while (m--) { scanf("%d%d", &x, &y); if (tag[x]) tag[y] = 1; siz[x]--; siz[y]...
#include <bits/stdc++.h> using namespace std; const int N = 200010; int tag[N], n, x, y, m, ans, siz[N]; vector<int> v; int main() { scanf("%d%d", &n, &m); tag[1] = 1; for (int i = 1; i <= n; i++) siz[i] = 1; while (m--) { scanf("%d%d", &x, &y); if (tag[x]) tag[y] = 1; siz[x]--; siz[y]...
[["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 6...
1
164
#include <bits/stdc++.h> using namespace std; const int N = 100000 + 10; int bgn[N]; bool vis[N]; int n, m; int c[N]; namespace solver { void solve() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) c[i] = 1, vis[i] = 0; vis[1] = 1; int x, y; for (int i = 1; i <= m; ++i) { scanf("%d%d", &x, &y)...
#include <bits/stdc++.h> using namespace std; const int N = 100000 + 10; int bgn[N]; bool vis[N]; int n, m; int c[N]; namespace solver { void solve() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) c[i] = 1, vis[i] = 0; vis[1] = 1; int x, y; for (int i = 1; i <= m; ++i) { scanf("%d%d", &x, &y)...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 0, 57, 75, 7...
1
225
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; using LL = long long; using ULL = unsigned long long; constexpr l...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; using LL = long long; using ULL = unsigned long long; constexpr l...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 73], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25]]
1
233
#include <bits/stdc++.h> using namespace std; int a[100001]; int b[100001]; int main() { int i; int n, m; cin >> n >> m; for (i = 1; i <= n; i++) a[i] = 1; int cou = 1; b[1] = 1; int cur = 1; for (i = 0; i < m; i++) { int x, y; cin >> x >> y; if (b[x]) { a[x]--; a[y]++; ...
#include <bits/stdc++.h> using namespace std; int a[100001]; int b[100001]; int main() { int i; int n, m; cin >> n >> m; for (i = 1; i <= n; i++) a[i] = 1; int cou = 1; b[1] = 1; int cur = 1; for (i = 0; i < m; i++) { int x, y; cin >> x >> y; if (b[x]) { a[x]--; a[y]++; ...
[["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 64, 9, 0,...
1
179
#include <bits/stdc++.h> #define FI(i, a, b) for (int i = (a); i <= (b); i++) #define FD(i, a, b) for (int i = (a); i >= (b); i--) #define LL long long #define Ldouble long double #define PI 3.14159265358979323846264338327950288419 #define PII pair<int, int> #define PLL pair<LL, LL> #define mp make_pair #define fi f...
#include <bits/stdc++.h> #define FI(i, a, b) for (int i = (a); i <= (b); i++) #define FD(i, a, b) for (int i = (a); i >= (b); i--) #define LL long long #define Ldouble long double #define PI 3.14159265358979323846264338327950288419 #define PII pair<int, int> #define PLL pair<LL, LL> #define mp make_pair #define fi f...
[["+", 0, 14, 8, 9, 0, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60...
1
203
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 64, 1, 0, 11, 31, 69, 341, 342, 0, 73], [...
1
515
#include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> b, r, x, y; b.resize(n); r.resize(n); x.resize(m); y.resize(m); for (int i = 0; i < m; i++) { cin >> x[i] >> y[i]; } for (int i = 0; i < n; i++) { b[i] = 1; } r[0] = 1; for (int...
#include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> b, r, x, y; b.resize(n); r.resize(n); x.resize(m); y.resize(m); for (int i = 0; i < m; i++) { cin >> x[i] >> y[i]; } for (int i = 0; i < n; i++) { b[i] = 1; } r[0] = 1; for (int...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 31, 69, 341, 342, 0, 16, 31, 69, 28, 22], ["+", 341, 342, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 341, 342, 0, 16, 31, 69, 341, 342, 0, ...
1
247
#include <iostream> #include <vector> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; vector<int> crveni(n + 1, false); vector<int> broj_na_topki(n + 1, 1); crveni[1] = true; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; if (!broj_na_topki[...
#include <iostream> #include <vector> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; vector<int> crveni(n + 1, false); vector<int> broj_na_topki(n + 1, 1); crveni[1] = true; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; if (!broj_na_topki[...
[["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9...
1
185
// rozwiazanie wzorcowe // Autor: Kacper Walentynowicz // O(n + m) #include <bits/stdc++.h> using namespace std; const int maxn = 1e5; int n, m, a, b, ile[maxn + 1], cza[maxn + 1]; int main() { ios_base::sync_with_stdio(0); cza[1] = 1; cin >> n >> m; for (int i = 1; i <= m; ++i) { cin >> a >> b; if (ile...
// rozwiazanie wzorcowe // Autor: Kacper Walentynowicz // O(n + m) #include <bits/stdc++.h> using namespace std; const int maxn = 1e5; int n, m, a, b, ile[maxn + 1], cza[maxn + 1]; int main() { ios_base::sync_with_stdio(0); cza[1] = 1; cin >> n >> m; for (int i = 1; i <= n; ++i) ile[i] = 1; for (int i = 1...
[["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 35], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 25], ["+", 0, 7, 8, 1, 0, 11, 31, 69, 28, 22], ["+", 8, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 8, 1, 0, 11, 31, 69,...
1
170
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define MOD 1000000007 using namespace std; typ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define MOD 1000000007 using namespace std; ty...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 146], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0...
1
227
/*{{{*/ //#pragma GCC optimize("O3") #include <bits/stdc++.h> #ifdef __linux__ #define getchar getchar_unlocked #define putchar putchar_unlocked #endif typedef long long ll; typedef std::pair<int, int> pii; std::string Name = __FILE__; std::string iput = Name.substr(0, Name.length() - 4) + ".in"; std::string oput ...
/*{{{*/ //#pragma GCC optimize("O3") #include <bits/stdc++.h> #ifdef __linux__ #define getchar getchar_unlocked #define putchar putchar_unlocked #endif typedef long long ll; typedef std::pair<int, int> pii; std::string Name = __FILE__; std::string iput = Name.substr(0, Name.length() - 4) + ".in"; std::string oput ...
[["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 1, 0, 34, 0, 21], ["-", 0, 57, 64, 1, 0, ...
1
574
#include <bits/stdc++.h> using namespace std; int s[100005]; bool a[100005]; int main() { fill(s, s + 100005, 1); a[0] = true; int b; cin >> b >> b; for (int c = 0; c < b; c++) { int d, e; scanf("%d%d", &d, &e); d--; e--; if (a[d]) { if (s[d] == 1) a[d] = false; s[d]--...
#include <bits/stdc++.h> using namespace std; int s[100005]; bool a[100005]; int main() { fill(s, s + 100005, 1); a[0] = true; int b; cin >> b >> b; for (int c = 0; c < b; c++) { int d, e; scanf("%d%d", &d, &e); d--; e--; if (a[d]) { if (s[d] == 1) a[d] = false; a[e] =...
[["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9...
1
172
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <vector> using namespace std; template <class T> void gc(T &x) { int s, k, m = 0; x = 0; k = getchar_unlocked(); if (k == '-') s = 1; k = getchar_unlocked(); while (true) { k = getchar_unlocked(); if (k < '0' || k > '9') brea...
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <vector> using namespace std; template <class T> void gc(T &x) { int s, k, m = 0; x = 0; k = getchar_unlocked(); if (k == '-') s = 1; else if ('0' <= k && k <= '9') x = k - '0'; while (true) { k = getchar_unlocked(); if (k < '0...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 15, 339, 51, 16, 31, 16, 31, 103, 0, 104], ["+", 15, 339, 51, 16, 31, 16, 31, 103, 0, 125], ["+", 0, 57, ...
1
308
#include <stdio.h> int main() { int i, n, m, c[100010] = {1}, a, b, r[100010] = {1}; scanf("%d %d", &n, &m); while (m--) { scanf("%d %d", &a, &b); c[--b]++; c[--a]--; r[b] |= r[a]; if (c[a] == 0) r[a] = 0; } for (i = m = 0; i < n; i++) m += r[i]; printf("%d\n", m); retur...
#include <stdio.h> int main() { int i, n, m, c[100010], a, b, r[100010] = {1}; scanf("%d %d", &n, &m); for (i = 0; i < n; i++) c[i] = 1; while (m--) { scanf("%d %d", &a, &b); c[--b]++; c[--a]--; r[b] |= r[a]; if (c[a] == 0) r[a] = 0; } for (i = m = 0; i < n; i++) m += r...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 7...
0
145
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, m; cin >> n >> m; int flg[n], c[n]; flg[0] = 1; for (int i = 0; i < n; i++) c[i] = 1; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; x--; y--; c[x]--; c[y]++; if (flg[x] == 1) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, m; cin >> n >> m; ll flg[n], c[n]; for (int i = 0; i < n; i++) flg[i] = 0; flg[0] = 1; for (int i = 0; i < n; i++) c[i] = 1; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; x--; y--; c...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49,...
1
186
#include <bits/stdc++.h> using namespace std; int N, M, x, y, pt, v[100005], red[100005]; int main() { cin >> N >> M; for (int i = 0; i < N; i++) v[i] = 1; red[1] = 1; for (int i = 0; i < M; i++) { cin >> x >> y; v[x]--, v[y]++; if (red[x]) red[y] = 1; } for (int i = 1; i <= N; i++)...
#include <bits/stdc++.h> using namespace std; int N, M, x, y, pt, v[100005], red[100005]; int main() { cin >> N >> M; for (int i = 0; i <= N; i++) v[i] = 1; red[1] = 1; for (int i = 0; i < M; i++) { cin >> x >> y; v[x]--, v[y]++; if (red[x]) red[y] = 1; if (!v[x]) red[x] = 0; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 57, 64, 1, 0, 35], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 0, 57, 15, 339, 51, 91, 28, 69, 28, 22], ["+", 15, 339, 51, 9...
1
152
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ext/rope> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, m, n) for (i = m; i <= n; i++) #defi...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ext/rope> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, m, n) for (i = m; i <= n; i++) #defi...
[["-", 0, 14, 8, 9, 0, 9, 0, 57, 0, 121], ["-", 8, 9, 0, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 73], ["-", 8, 9, 0, 9, 0, 57, 15, 339, 0, 25], ["+",...
1
348
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef pair<int, int> ...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef pair<int, int> ...
[["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 11, 31, 69, 341, 342, 0, 69, 28, 22], ["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, 73], ["-", 0, 1, 0, 11, 31, 69, 341, 342, ...
1
287
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ff first #define ss second #define mp make_pair typedef long long llong; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; void solve() { int n, m; cin >> n >> m; vector<int> cnt(n, 1); vector<bool> red(n); ...
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ff first #define ss second #define mp make_pair typedef long long llong; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; void solve() { int n, m; cin >> n >> m; vector<int> cnt(n, 1); vector<bool> red(n); ...
[["+", 8, 9, 0, 1, 0, 27, 28, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 73], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["-", 64, 9, 0, 1, 0, 27...
1
241
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ff first #define ss second #define mp make_pair typedef long long llong; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; void solve() { int n, m; cin >> n >> m; vector<int> cnt(n, 1); vector<bool> red(n); ...
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ff first #define ss second #define mp make_pair typedef long long llong; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; void solve() { int n, m; cin >> n >> m; vector<int> cnt(n, 1); vector<bool> red(n); ...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 73], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["-", ...
1
244
#include <bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n, m; cin >> n >> m; int x[m], y[m]; rep(i, m) { cin >> x[i] >> y[i]; } vector<bool> red(n, false); red[0] = true; vector<int> wh...
#include <bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n, m; cin >> n >> m; int x[m], y[m]; rep(i, m) { cin >> x[i] >> y[i]; } vector<bool> red(n, false); red[0] = true; vector<int> wh...
[["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 14, 8...
1
216
#include <bits/stdc++.h> #define x first #define pb push_back #define y second const int NMAX = 100666; using namespace std; typedef long long LL; typedef pair<int, int> PII; int mark[NMAX]; int sz[NMAX]; int rs; int a, b, n, m; int main() { // freopen("input.in", "rt", stdin); cin >> n >> m; for (int i = 1; i...
#include <bits/stdc++.h> #define x first #define pb push_back #define y second const int NMAX = 100666; using namespace std; typedef long long LL; typedef pair<int, int> PII; int mark[NMAX]; int sz[NMAX]; int rs; int a, b, n, m; int main() { // freopen("input.in", "rt", stdin); cin >> n >> m; for (int i = 1; i...
[["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 7, 8,...
1
191
#include <cstdio> const int MAXN = 1E5 + 5; int array[MAXN]{}; int visit[MAXN]{}; int Ans = 0, M, N, U, V; int main() { scanf(" %d%d", &N, &M); for (int i = 1; i <= N; ++i) array[i] = 1; visit[1] = true; for (int i = 0; i < M; ++i) { scanf(" %d%d", &U, &V); if (!visit[V] || (visit[U] && visit[V])) ...
#include <cstdio> const int MAXN = 1E5 + 5; int array[MAXN]{}; int visit[MAXN]{}; int Ans = 0, M, N, U, V; int main() { scanf(" %d%d", &N, &M); for (int i = 1; i <= N; ++i) array[i] = 1; visit[1] = true; for (int i = 0; i < M; ++i) { scanf(" %d%d", &U, &V); if (visit[U]) visit[V] = true; ...
[["-", 0, 57, 15, 339, 51, 16, 31, 91, 17, 111], ["-", 51, 16, 31, 91, 28, 69, 341, 342, 0, 22], ["-", 51, 16, 31, 91, 28, 69, 341, 342, 0, 73], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["-", 51, 16, 12, 23, 0, 16, 31, 69, 28, 22], ["-", 12, 23, 0, 16, 31, 69, 341, 342...
1
216
#include <bits/stdc++.h> using namespace std; long long a[100000]; bool memo[100000]; int c[100000]; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; cin >> n >> m; memo[0] = true; c[0] = 1; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; x--; y--; memo[y] |= ...
#include <bits/stdc++.h> using namespace std; long long a[100000]; bool memo[100000]; int c[100000]; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; cin >> n >> m; memo[0] = true; for (int i = 0; i < n; i++) c[i] = 1; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; ...
[["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 7, 15,...
1
186
#include <cstdio> using namespace std; const int maxn = 1e5 + 2; int n, l, pos; int a[maxn]; int main() { scanf("%d%d%d", &n, &l, &a[1]); for (int i = 2; i <= n; i++) { scanf("%d", &a[i]); if (a[i - 1] + a[i] >= l) pos = i; } if (!pos) printf("Impossible\n"); else { printf("Possible\n");...
#include <cstdio> using namespace std; const int maxn = 1e5 + 2; int n, l, pos; int a[maxn]; int main() { scanf("%d%d", &n, &l); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); if (a[i - 1] + a[i] >= l) pos = i - 1; } if (!pos) printf("Impossible\n"); else { printf("Possible\n"); ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["-", 0, 2, 3, 4, 0, 66, 28, 69, 28, 22], ["-", 3, 4, 0, 66, 28, 69, 341, 342, 0, 70], ["-", 3, 4, 0, 66, 28, 69, 341, 342, 0, 13], ["-", 3, 4, 0, 66, 28, 69, 341, 342...
1
178
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()) #define VRSORT(v) sort(v.rbegin(), v.rend()) #define ll long long #define pb(a) push_back(a) #define INF 1000000000 #define LINF 1e18 #define MOD 1000000007 using namespace...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()) #define VRSORT(v) sort(v.rbegin(), v.rend()) #define ll long long #define pb(a) push_back(a) #define INF 1000000000 #define LINF 1e18 #define MOD 1000000007 using namespace...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 20], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 57...
1
468
#include <bits/stdc++.h> using namespace std; int main() { int n, l; cin >> n >> l; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } bool flag = false; int cut = 0; for (int i = 0; i < n - 1; ++i) { if (a[i] + a[i + 1] >= l) { flag = true; cut = i + 1; // ロープiとi+1の結...
#include <bits/stdc++.h> using namespace std; int main() { int n, l; cin >> n >> l; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } bool flag = false; int cut = 0; for (int i = 0; i < n - 1; ++i) { if (a[i] + a[i + 1] >= l) { flag = true; cut = i + 1; // ロープiとi+1の結...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 7, 8, 9, 0, 1, 0...
1
177
/* user: sky48 language: c++ for dream for young */ #include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i <= b; i++) #define N 100005 typedef long long ll; using namespace std; int las, n, m, a[N]; int gets() { int v = 0; char ch; bool f = 0; while (!isdigit(ch = getchar())) if (ch == '-') ...
/* user: sky48 language: c++ for dream for young */ #include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i <= b; i++) #define N 100005 typedef long long ll; using namespace std; int las, n, m, a[N]; int gets() { int v = 0; char ch; bool f = 0; while (!isdigit(ch = getchar())) if (ch == '-') ...
[["-", 0, 1, 0, 16, 31, 16, 31, 2, 63, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 21], ["-", 31, 16, 31, 2, 3, 4, 0, 16, 31, 22], ["-", 31, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["-", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 7, 10, 4...
1
256
#include <algorithm> #include <iostream> #include <numeric> #include <queue> #include <vector> using namespace std; int main() { int n, l; cin >> n >> l; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { if (a[i] + a[i + 1] >= l) { cout << "Possible\n"...
#include <algorithm> #include <iostream> #include <numeric> #include <queue> #include <vector> using namespace std; int main() { int n, l; cin >> n >> l; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { if (a[i] + a[i + 1] >= l) { cout << "Possible\n"...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 57, 64, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 57, ...
1
168
#include <iostream> using namespace std; typedef long long ll; const int MAX_N = 1e5 + 1; ll A[MAX_N]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; ll L; cin >> N >> L; for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i < N - 1; i++) { if (A[i] + A[i + 1] < L) cont...
#include <iostream> using namespace std; typedef long long ll; const int MAX_N = 1e5 + 1; ll A[MAX_N]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; ll L; cin >> N >> L; for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i < N - 1; i++) { if (A[i] + A[i + 1] < L) cont...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 7, 8, 9,...
1
192
#include <bits/stdc++.h> using namespace std; #define int long long #define all(a) a.begin(), a.end() #define rep(i, n) for (int i = 0; i < n; i++) signed main(void) { int n, l; cin >> n >> l; vector<int> V(n); rep(i, n) cin >> V[i]; int x; bool a = false; rep(i, n - 1) { if (V[i] + V[i + 1] >= l) { ...
#include <bits/stdc++.h> using namespace std; #define int long long #define all(a) a.begin(), a.end() #define rep(i, n) for (int i = 0; i < n; i++) signed main(void) { int n, l; cin >> n >> l; vector<int> V(n); rep(i, n) cin >> V[i]; int x; bool a = false; rep(i, n - 1) { if (V[i] + V[i + 1] >= l) { ...
[["-", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 7, 0, 88], ["+", 0, 57, 64, 9, 0, 7, 10, 43, 39, 40], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 64, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, ...
1
215
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int main() { int n, L; cin >> n >> L; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; ...
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int main() { int n, L; cin >> n >> L; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; ...
[["+", 0, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
210
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using T = tuple<ll, ll, ll>; const ll INF = 1LL << 61LL; const ll MOD = 1e9 + 7; int main() { ll N, L; cin >> N >> L; vector<ll> a(N); for (int i = 0; i < N; i++) cin >> a[i]; for (int i = 0; i < N - 1; i++) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using T = tuple<ll, ll, ll>; const ll INF = 1LL << 61LL; const ll MOD = 1e9 + 7; int main() { ll N, L; cin >> N >> L; vector<ll> a(N); for (int i = 0; i < N; i++) cin >> a[i]; for (int i = 0; i < N - 1; i++) { ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 57...
1
213
#include <bits/stdc++.h> using namespace std; #define IL inline #define rep(i, j, k) for (int i = j; i <= k; ++i) #define repd(i, j, k) for (int i = j; i >= k; --i) #define pb push_back #define db double #define mp make_pair #define mp3(a, b, c) mp(mp(a, b), c) #define pii pair<int, int> #define piii pair<pii, int> #de...
#include <bits/stdc++.h> using namespace std; #define IL inline #define rep(i, j, k) for (int i = j; i <= k; ++i) #define repd(i, j, k) for (int i = j; i >= k; --i) #define pb push_back #define db double #define mp make_pair #define mp3(a, b, c) mp(mp(a, b), c) #define pii pair<int, int> #define piii pair<pii, int> #de...
[["-", 75, 76, 0, 9, 0, 1, 0, 2, 63, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 21], [...
1
639
// fold #ifndef KHALIL #include <bits/stdc++.h> #else #include "header.h" #endif #define endl '\n' #define mp make_pair #define tostr(x) \ static_cast<ostringstream &>((ostringstream() << dec << x)).str() #define rep(i, begin, end) for (auto i = begin; i <...
// fold #ifndef KHALIL #include <bits/stdc++.h> #else #include "header.h" #endif #define endl '\n' #define mp make_pair #define tostr(x) \ static_cast<ostringstream &>((ostringstream() << dec << x)).str() #define rep(i, begin, end) for (auto i = begin; i <...
[["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], [...
1
617
/*#include <iostream> #include <algorithm> #include <array> #include <cmath> #include <deque> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> */ #include <bits/stdc++.h> using namespace std; #define int long long #de...
/*#include <iostream> #include <algorithm> #include <array> #include <cmath> #include <deque> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> */ #include <bits/stdc++.h> using namespace std; #define int long long #de...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 9, 0, 57, 64, 9, 0, 126, 0, 127], ["+", 0, 9, 0, 57, 64, 9, 0, 126, 128, 129], ["+", 0, 30, 0, 14, 8, 9, 0, 97, 128, 129], ["+", 0, 30, 0, 14, 8, 9, 0, 97, 0, 102], ["-", 0, 9, 0, 1, 0,...
1
1,103
#include <stdio.h> int main() { int i, a[100000], l, n, f = -1; scanf("%d%d", &n, &l); for (i = 0; i < n; i++) scanf("%d", &a[i]); for (i = 0; i < n - 1; i++) { if (l <= a[i] + a[i + 1]) { // puts("Possible"); f = i; // break; } } if (f == -1) { puts("Imossible"); retu...
#include <stdio.h> int main() { int i, n, f = -1; long long l, a[100000]; scanf("%d%d", &n, &l); for (i = 0; i < n; i++) scanf("%lld", &a[i]); for (i = 0; i < n - 1; i++) { if (l <= a[i] + a[i + 1]) { // puts("Possible"); f = i; // break; } } if (f == -1) { puts("Impossi...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 0, 70], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 0, 73], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43,...
0
185
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int n, l, a[maxn], pos, ans[maxn], cnt; int main() { scanf("%d%d", &n, &l); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); pos = -1; for (int i = 1; i < n; i++) if (a[i] + a[i + 1] >= l) { pos = i; break; } if ...
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int n, l, a[maxn], pos, ans[maxn], cnt; int main() { scanf("%d%d", &n, &l); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); pos = -1; for (int i = 1; i < n; i++) if (a[i] + a[i + 1] >= l) { pos = i; break; } if ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 47], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18], ["+", 75, ...
1
226
#include <algorithm> #include <cctype> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, n) for (ll(i) = (0); (i) < (n); ++i) #define PB push_back #define MP make_pair #define FI first #define ...
#include <algorithm> #include <cctype> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, n) for (ll(i) = (0); (i) < (n); ++i) #define PB push_back #define MP make_pair #define FI first #define ...
[["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
316
#include "bits/stdc++.h" using namespace std; #define int long long #define ll long long typedef pair<int, int> P; #define mod 1000000007 #define INF (1LL << 60) #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define YES cout << "YES" << endl #define Yes cout << "Yes" << endl #define NO cout << "...
#include "bits/stdc++.h" using namespace std; #define int long long #define ll long long typedef pair<int, int> P; #define mod 1000000007 #define INF (1LL << 60) #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define YES cout << "YES" << endl #define Yes cout << "Yes" << endl #define NO cout << "...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 75, 76, 0, 9, 0, 7, 10, 43, 0, 35], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 31, 22], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 7, 1...
1
213
//#include <bits/stdc++.h> #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define INF 10000000...
//#include <bits/stdc++.h> #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define INF 10000000...
[["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 1, 0, 16, 31, 16, 31, 2, 63, 22], ["+", 0, 9, 0, 57, 64, 9, 0, 7, 0, 88], ["+", 0, 57, 64, 9, 0, 7, 10, 43, 39, 40], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 21], ["+", 64, 9, 0, 7, 10, 43, ...
1
207
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, L; cin >> N >> L; int pre_a; int last_idx = -1; cin >> pre_a; for (int i = 1; i < N; ++i) { int cur_a; cin >> cur_a; if (pre_a + cur_a >= L) { last_idx = i; } pr...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, L; cin >> N >> L; int pre_a; int last_idx = -1; cin >> pre_a; for (int i = 1; i < N; ++i) { int cur_a; cin >> cur_a; if (pre_a + cur_a >= L) { last_idx = i; break;...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 14, 8,...
1
182
N, L = list(map(int, input().split())) a = list(map(int, input().split())) judge = "Impossible" for i in range(N - 1): x = a[i] + a[i + 1] if x >= L: judge = "Possible" c = i + 1 break if judge == "Impossible": print(judge) else: print(judge) for i in range(1, c): print(i) for i in range(c + 1, N): p...
N, L = list(map(int, input().split())) a = list(map(int, input().split())) judge = "Impossible" for i in range(N - 1): x = a[i] + a[i + 1] if x >= L: judge = "Possible" c = i + 1 break if judge == "Impossible": print(judge) else: print(judge) for i in range(1, c): print(i) for i in range(N - c - 1): ...
[["+", 12, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["+",...
5
131
#include <bits/stdc++.h> #define ll long long #define rw freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout); #define pb push_back #define F first #define S second #define pf push_front #define lp(i, a, b) for (int i = a; i <= (int)b; ++i) #define lp2(i, a, b) for (int i = a; i >= b; --i) #define f(x) ...
#include <bits/stdc++.h> #define ll long long #define rw freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout); #define pb push_back #define F first #define S second #define pf push_front #define lp(i, a, b) for (int i = a; i <= (int)b; ++i) #define lp2(i, a, b) for (int i = a; i >= b; --i) #define f(x) ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 1, 0, 16, 31, 16, 31, 2, 63, 22], ["+", 0, 1, 0, 16, 31, 16, 31, 2, 63, 22], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 21], ["-", 31, 16, 31, 2, 3, 4...
1
265