problem_id
stringlengths
6
6
language
stringclasses
2 values
original_status
stringclasses
3 values
original_src
stringlengths
19
243k
changed_src
stringlengths
19
243k
change
stringclasses
3 values
i1
int64
0
8.44k
i2
int64
0
8.44k
j1
int64
0
8.44k
j2
int64
0
8.44k
error
stringclasses
270 values
stderr
stringlengths
0
226k
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define ull unsigned long long #define ff first #define ss second #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> #define ll long long int #define ull unsigned long long #define ff first #define ss second #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
delete
16
20
16
16
-11
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<int> #define vll vector<long long> #define str string #define ch char #define all(x) x.begin(), x.end() #define pb push_back #define mp make_pair int dp[100000]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int...
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<int> #define vll vector<long long> #define str string #define ch char #define all(x) x.begin(), x.end() #define pb push_back #define mp make_pair int dp[100000]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int...
replace
28
30
28
30
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define MOD 1000000007 #define ar array #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); char game(int ...
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define MOD 1000000007 #define ar array #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); char game(int ...
replace
19
20
19
20
0
p03170
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdint> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <random> #include <regex> #include...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdint> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <random> #include <regex> #include...
replace
314
315
314
315
0
p03170
C++
Runtime Error
// {{{ #include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using n...
// {{{ #include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using n...
replace
61
62
61
65
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, x, n) for (int i = x; i < (n); i++) #define ALL(n) begin(n), end(n) #define MOD 1000000007 #define INF 1e9 #define INFL 1e12 typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; templa...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, x, n) for (int i = x; i < (n); i++) #define ALL(n) begin(n), end(n) #define MOD 1000000007 #define INF 1e9 #define INFL 1e12 typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; templa...
replace
38
39
38
39
0
p03170
C++
Runtime Error
// We only fail when we stop trying #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define endl '\n' #define D(x) cerr << #x << " = " << (x) << '\n' #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() const int N = 101; const int V = 100010; int n, k; int a[N...
// We only fail when we stop trying #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define endl '\n' #define D(x) cerr << #x << " = " << (x) << '\n' #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() const int N = 101; const int V = 100010; int n, k; int a[N...
replace
15
16
15
16
0
p03170
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <stack> #include <st...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <stack> #include <st...
replace
43
44
43
44
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.ti...
#include <bits/stdc++.h> using namespace std; #define ll long long #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.ti...
replace
28
29
28
29
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) #define pb push_back #define eb emplace_back using ll = long long; using P = pair<int, int>; using LP = pair<ll, int>; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) const ll MO...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) #define pb push_back #define eb emplace_back using ll = long long; using P = pair<int, int>; using LP = pair<ll, int>; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) const ll MO...
replace
22
23
22
26
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) #define pb push_back #define eb emplace_back using ll = long long; using P = pair<int, int>; using LP = pair<ll, int>; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) const ll MO...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) #define pb push_back #define eb emplace_back using ll = long long; using P = pair<int, int>; using LP = pair<ll, int>; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) const ll MO...
replace
18
19
18
19
0
p03170
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <functional> #include <iostream> #include <set> #include <utility> #include <vector> using namespace std; typedef unsigned long long ull; typedef pair<ull, ull> p; #define mp make_pair #define append push_back vector<ull> v; set<ull> s; multiset<ul...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <functional> #include <iostream> #include <set> #include <utility> #include <vector> using namespace std; typedef long long ull; typedef pair<ull, ull> p; #define mp make_pair #define append push_back vector<ull> v; set<ull> s; multiset<ull> ms; ul...
replace
9
10
9
10
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03170
C++
Runtime Error
// DO NOT USE: A N (segtree) #include <bits/stdc++.h> using namespace std; // MACROS #define ll long long #define pii pair<int, int> #define f(a, b, c) for (int a = b; a < c; a++) #define read(t) \ ll t; ...
// DO NOT USE: A N (segtree) #include <bits/stdc++.h> using namespace std; // MACROS #define ll long long #define pii pair<int, int> #define f(a, b, c) for (int a = b; a < c; a++) #define read(t) \ ll t; ...
replace
71
74
71
82
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // Define using ll = long long; using ull = unsigned long long; using ld = long double; const ll dx[4] = {1, 0, -1, 0}; const ll dy[4] = {0, 1, 0, -1}; const ll MOD = 1e9 + 7; const ll mod = 998244353; const ll inf = 1 << 30; const ll LINF = LONG_MAX; const ll INF = 1LL <<...
#include <bits/stdc++.h> using namespace std; // Define using ll = long long; using ull = unsigned long long; using ld = long double; const ll dx[4] = {1, 0, -1, 0}; const ll dy[4] = {0, 1, 0, -1}; const ll MOD = 1e9 + 7; const ll mod = 998244353; const ll inf = 1 << 30; const ll LINF = LONG_MAX; const ll INF = 1LL <<...
replace
650
651
650
651
0
p03170
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <tuple> #include <vector> using namespa...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <tuple> #include <vector> using namespa...
replace
98
99
98
99
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long using namespace std; int n, k; vector<int> v; int dp[100005]; void solve() { for (int i = 1; i <= k; ++i) { if (dp[i] >= 0) continue; int res; for (int j = 0; j < n; ++j) { res = dp[i - v[j]]; if (res == 1) { dp[i] = 2; } el...
#include <bits/stdc++.h> #define ll long long using namespace std; int n, k; vector<int> v; int dp[100005]; void solve() { for (int i = 1; i <= k; ++i) { if (dp[i] >= 0) continue; int res; for (int j = 0; j < n; ++j) { int tam = (i - v[j]); if (tam < 0) continue; res = ...
replace
16
17
16
20
0
p03170
C++
Runtime Error
#include <iomanip> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <string.h> #include <vector> #define Max (int)1e5 + 10 #define MAX_INT (int)1e9 + 2 #define MOD ((int)1e9 + 7) using namespace std; int dp[Max]; void init() { int i; for (i = 0; i < Max; i++) dp[i] = -1; } i...
#include <iomanip> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <string.h> #include <vector> #define Max (int)1e5 + 10 #define MAX_INT (int)1e9 + 2 #define MOD ((int)1e9 + 7) using namespace std; int dp[Max]; void init() { int i; for (i = 0; i < Max; i++) dp[i] = -1; } i...
replace
27
29
27
31
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 105, K = 100005; int a[N], dp[K]; vector<int> q; int main() { int n, k; scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); sort(a + 1, a + n + 1); for (int i = 0; i < a[1]; i++) dp[i] = 0; for (int i = a[1]; i <= k; i++...
#include <bits/stdc++.h> using namespace std; const int N = 105, K = 100005; int a[N], dp[K]; vector<int> q; int main() { int n, k; scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); sort(a + 1, a + n + 1); for (int i = 0; i < a[1]; i++) dp[i] = 0; for (int i = a[1]; i <= k; i++...
replace
15
16
15
16
0
p03170
C++
Runtime Error
#include <iostream> using namespace std; int main() { int n, K; cin >> n >> K; int niz[n]; for (int i = 0; i < n; i++) cin >> niz[i]; int df[K + 1]; df[0] = 2; for (int i = 1; i < K + 1; i++) { bool t = false; for (int j = 0; j < n; j++) { if (df[i - niz[j]] == 2) { t = true; ...
#include <iostream> using namespace std; int main() { int n, K; cin >> n >> K; int niz[n]; for (int i = 0; i < n; i++) cin >> niz[i]; int df[K + 1]; df[0] = 2; for (int i = 1; i < K + 1; i++) { bool t = false; for (int j = 0; j < n; j++) { if (i >= niz[j] && df[i - niz[j]] == 2) { ...
replace
16
17
16
17
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0)...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define fastio() \ ios_base::sync_with_stdio(0); \ cin.tie(0)...
replace
31
32
31
32
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using VI = vector<ll>; using VV = vector<VI>; using VS = vector<string>; using PII = pair<ll, ll>; // tourist set template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A...
#include <bits/stdc++.h> using namespace std; using ll = long long; using VI = vector<ll>; using VV = vector<VI>; using VS = vector<string>; using PII = pair<ll, ll>; // tourist set template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A...
replace
149
150
149
151
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define f(i, l, n) for (int i = l; i < n; i++) #define E "\n" #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define int long long #define f(i, l, n) for (int i = l; i < n; i++) #define E "\n" #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
delete
43
48
43
43
-11
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define vec(k) vector<k> #define vecvec(k) vector<vector<k>> #define pai(k) pair<k, k> #define mod 1000000007 #define mpai make_pair #define p1 first #define p2 second #define umap(x, y) unordered_map<x, y> int solve(int *arr, int n, int k) { int...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define vec(k) vector<k> #define vecvec(k) vector<vector<k>> #define pai(k) pair<k, k> #define mod 1000000007 #define mpai make_pair #define p1 first #define p2 second #define umap(x, y) unordered_map<x, y> int solve(int *arr, int n, int k) { int...
replace
29
30
29
33
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> using namespace std; int main(void) { int N, K; cin >> N >> K; vector<int> a(N); for (int i = 0; i < N; i++) cin >> a[i]; vector<bool> stones(K + 3, false); // 1,2, ... Kまでの値で // それぞれ先手必勝or後手必勝7日を調べる // 答えはstones[K]により判定される // stones[K] == trueならば ...
#include <bits/stdc++.h> #include <iostream> using namespace std; int main(void) { int N, K; cin >> N >> K; vector<int> a(N); for (int i = 0; i < N; i++) cin >> a[i]; vector<bool> stones(K + 3, false); // 1,2, ... Kまでの値で // それぞれ先手必勝or後手必勝7日を調べる // 答えはstones[K]により判定される // stones[K] == trueならば ...
replace
25
26
25
26
0
p03170
C++
Runtime Error
#include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) int dp[100010]; int a[110]; int main() { int n, k; cin >> n >> k; REP(i, n) { cin >> a[i]; } REP(i, k + 1) { dp[i] = 0; } REP(i, k) { if (i < a[0]) { dp[i] = -1; } REP(j, n) { if (dp[i + a[j]...
#include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) int dp[100010]; int a[110]; int main() { int n, k; cin >> n >> k; REP(i, n) { cin >> a[i]; } REP(i, k + 1) { dp[i] = 0; } REP(i, k) { if (i < a[0]) { dp[i] = -1; } REP(j, n) { if (i + a[j] > ...
insert
23
23
23
25
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define AB_BHI_NI_DEGI \ ios_base::sync_with_stdio(false); \ cin....
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define AB_BHI_NI_DEGI \ ios_base::sync_with_stdio(false); \ cin....
replace
36
38
36
38
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { int n, k; cin >> n >> k; vector<int> a(n); rep(i, n) cin >> a[i]; vector<bool> dp(k + 1, false); for (int i = a[0]; i < dp.size(); i++) { rep(j, a.size()) { if (dp[i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { int n, k; cin >> n >> k; vector<int> a(n); rep(i, n) cin >> a[i]; vector<bool> dp(k + 1, false); for (int i = a[0]; i < dp.size(); i++) { rep(j, a.size()) { if (i - ...
replace
16
17
16
17
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define X first #define Y second #define pb push_back void solve(); int main() { // freopen("schools.in", "r", stdin); // freopen("schools.out", "w", stdout); ios_base::sync_with_stdio(0), cin.tie(0); // cout << fixed ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define X first #define Y second #define pb push_back void solve(); int main() { // freopen("schools.in", "r", stdin); // freopen("schools.out", "w", stdout); ios_base::sync_with_stdio(0), cin.tie(0); // cout << fixed ...
replace
23
24
23
24
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int // #include "../../Template.cpp" vector<vector<int>> dp; int n, k; vector<int> arr; int solve(int left = k, int chance = 0) { if (dp[chance][left] != -1) { return dp[chance][left]; } int ans = chance; for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; #define int long long int // #include "../../Template.cpp" vector<vector<int>> dp; int n, k; vector<int> arr; int solve(int left = k, int chance = 0) { if (dp[chance][left] != -1) { return dp[chance][left]; } int ans = chance; for (int i = 0; i < n; i++) { ...
replace
23
24
23
24
0
p03170
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { int n, k; cin >> n >> k; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; vector<bool> dp(n + 1, 0); for (int...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { int n, k; cin >> n >> k; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; vector<bool> dp(k + 1, 0); for (int...
replace
16
17
16
17
0
p03170
C++
Runtime Error
/* _________________________________________________________________________________________________ | | | Author : Aditya Ahuja | | Date : Sun, 4th Aug 2019 | |_____________________________________________________________________________...
/* _________________________________________________________________________________________________ | | | Author : Aditya Ahuja | | Date : Sun, 4th Aug 2019 | |_____________________________________________________________________________...
replace
80
81
80
81
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define ll long long string solve(int arr[], int k, int n) { vector<bool> dp(k + 1, 0); for (int i = 1; i <= k; i++) { for (int j = 0; j < n; j++) { if (i >= j) { if (dp[i - arr[j]] == 0) dp[i] = 1; } } } ...
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define ll long long string solve(int arr[], int k, int n) { vector<bool> dp(k + 1, 0); for (int i = 1; i <= k; i++) { for (int j = 0; j < n; j++) { if (i >= arr[j]) { if (dp[i - arr[j]] == 0) dp[i] = 1; } }...
replace
10
11
10
11
0
p03170
C++
Runtime Error
// #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define f first #define s second #define pb push_back #define REP(i, a, b) for (long long int i = a; i < b; i++) #define mp make_pair #define...
// #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define f first #define s second #define pb push_back #define REP(i, a, b) for (long long int i = a; i < b; i++) #define mp make_pair #define...
replace
178
182
178
182
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cou...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cou...
replace
15
20
15
22
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(x) x.begin(), x.end() #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define mp make_pair #define pb push_back #define em emplace #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, n) for (i...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(x) x.begin(), x.end() #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define mp make_pair #define pb push_back #define em emplace #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, n) for (i...
replace
31
32
31
32
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAX = 107; int a[MAX]; int g[MAX * MAX * MAX]; int main() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); int n, k; cin >> n >> k; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 1; i <= k; ++i) g[i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAX = 107; int a[MAX]; int g[MAX * MAX * MAX]; int main() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); int n, k; cin >> n >> k; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 1; i <= k; ++i) g[i...
replace
21
22
21
22
-11
p03170
C++
Runtime Error
// author:-*mdragneell* #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define pi pair<int, int> #define pl pair<ll, ll> int const N = 3001; ll min(ll x, ll y) { if (x < y) return x; else return y; } ll max(ll x, ll y) { if (x > y) ret...
// author:-*mdragneell* #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define pi pair<int, int> #define pl pair<ll, ll> int const N = 100005; ll min(ll x, ll y) { if (x < y) return x; else return y; } ll max(ll x, ll y) { if (x > y) r...
replace
11
12
11
12
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int dp[k + 1]; dp[0] = 0; int i = 1; while (i < a[0]) { dp[i] = 0; i++; } for (int i = a[0]; i <= k; i++) { dp[i] = 0; for (i...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int dp[k + 1]; dp[0] = 0; int i = 1; while (i < a[0]) { dp[i] = 0; i++; } for (int i = a[0]; i <= k; i++) { dp[i] = 0; for (i...
replace
21
22
21
22
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define loop(i, a, b) for (lli i = a; i <= b; ++i) #define fast \ ios::sync_with_stdio(false); \ cin.tie(0); \ ...
#include <bits/stdc++.h> #define loop(i, a, b) for (lli i = a; i <= b; ++i) #define fast \ ios::sync_with_stdio(false); \ cin.tie(0); \ ...
delete
10
16
10
10
-11
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll INFL = 1000000000000000010; // 10^18 = 2^60 int INF = 2000000000; // 10^9 ll MOD = 1000000007; vector<bool> W(100010); int main() { int N, K; cin >> N >> K; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a.at(i); } ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll INFL = 1000000000000000010; // 10^18 = 2^60 int INF = 2000000000; // 10^9 ll MOD = 1000000007; vector<bool> W(100010); int main() { int N, K; cin >> N >> K; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a.at(i); } ...
replace
19
20
19
22
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; bool dp[k + 1]; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; dp[0] = false; for (int i = 1; i < k + 1; i++) { dp[i] = false; for (int j = 0; j < n; j++) { if (a[j] <= k) { if (!dp[i - a[j]]...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; bool dp[k + 1]; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; dp[0] = false; for (int i = 1; i < k + 1; i++) { dp[i] = false; for (int j = 0; j < n; j++) { if (a[j] <= i) { if (!dp[i - a[j]]...
replace
14
15
14
15
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #include <chrono> #include <cstdio> #include <random> using namespace std; #define DRACARYS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> #include <chrono> #include <cstdio> #include <random> using namespace std; #define DRACARYS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
replace
23
24
23
24
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #include <stdio.h> #define ll long long #define M 300002 #define N 1000000000000000003 #define endl "\n" using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n, v; cin >> n >> v; ll arr[200004] = {0}; ll var[200003] = {0}; for (ll i = ...
#include <bits/stdc++.h> #include <stdio.h> #define ll long long #define M 300002 #define N 1000000000000000003 #define endl "\n" using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n, v; cin >> n >> v; ll arr[200004] = {0}; ll var[200003] = {0}; for (ll i = ...
replace
28
31
28
33
0
p03170
C++
Runtime Error
/* Code by : Suraj (@suraj1611) */ #include <bits/stdc++.h> #include <string> using namespace std; #define ll long long int #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define mx INT_MAX #define mn INT_MIN #define md 1000000007 #define pb push_back #define mp make_pa...
/* Code by : Suraj (@suraj1611) */ #include <bits/stdc++.h> #include <string> using namespace std; #define ll long long int #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define mx INT_MAX #define mn INT_MIN #define md 1000000007 #define pb push_back #define mp make_pa...
replace
47
49
47
49
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n, k; int a[1000005], f[1000005]; int solve(int x) { if (f[x] != -1) return f[x]; if (x == 0) return f[x] = 0; int ret = 0; for (int i = 1; i <= n; i++) { if (x >= a[i]) ret |= (solve(x - a[i]) ^ 1); } return ret; } int main() { scanf("%d...
#include <bits/stdc++.h> using namespace std; int n, k; int a[1000005], f[1000005]; int solve(int x) { if (f[x] != -1) return f[x]; if (x == 0) return f[x] = 0; int ret = 0; for (int i = 1; i <= n; i++) { if (x >= a[i]) ret |= (solve(x - a[i]) ^ 1); } return f[x] = ret; } int main() { sc...
replace
14
15
14
15
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h>#De #define DIM 107 #define INF 1000000007 using namespace std; long long n, k, a[DIM], used[DIM]; int main() { cin >> n >> k; for (int i = 1; i <= n; ++i) cin >> a[i]; for (int i = 1; i <= k; ++i) for (int j = 1; j <= n; ++j) if (i >= a[j] && used[i - a[j]] == 0) us...
#include <bits/stdc++.h>#De #define DIM 107 #define INF 1000000007 using namespace std; long long n, k, a[DIM], used[100007]; int main() { cin >> n >> k; for (int i = 1; i <= n; ++i) cin >> a[i]; for (int i = 1; i <= k; ++i) for (int j = 1; j <= n; ++j) if (i >= a[j] && used[i - a[j]] == 0) ...
replace
5
6
5
6
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define REP(i, n) for (int i = 0; i < n; i++) #define REPi(i, a, b) for (int i = int(a); i < int(b); i++) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } temp...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define REP(i, n) for (int i = 0; i < n; i++) #define REPi(i, a, b) for (int i = int(a); i < int(b); i++) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } temp...
insert
38
38
38
40
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; vector<int> grundy(100005, -1); int getMax(set<int> s) { int max = 0; while (s.find(max) != s.end()) max++; return max; } int getGrundy(int pos, int *a, int n) { if (grundy[pos] != -1) return grundy[pos]; set<int> s; for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; vector<int> grundy(100005, -1); int getMax(set<int> s) { int max = 0; while (s.find(max) != s.end()) max++; return max; } int getGrundy(int pos, int *a, int n) { if (grundy[pos] != -1) return grundy[pos]; set<int> s; for (int i = 0; i < n; i++) { ...
replace
22
23
22
23
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> posnum(n); for (int i = 0; i < n; i++) cin >> posnum[i]; vector<bool> dp(k + 1, false); for (int stone = 1; stone <= k; stone++) { for (int num = 0; num < n; num++) { if (dp[stone - posnum[num]] ==...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> posnum(n); for (int i = 0; i < n; i++) cin >> posnum[i]; vector<bool> dp(k + 1, false); for (int stone = 1; stone <= k; stone++) { for (int num = 0; num < n; num++) { if (stone >= posnum[num] && dp...
replace
12
13
12
13
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; /* #ifndef ONLINE_JUDGE #define cin f #define cout g ifstream cin("a.in"); ofstream cout("a.out"); #endif */ int n, k, v[103]; bool viz[1 << 17]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; for (int ...
#include <bits/stdc++.h> using namespace std; /* #ifndef ONLINE_JUDGE #define cin f #define cout g ifstream cin("a.in"); ofstream cout("a.out"); #endif */ int n, k, v[103]; bool viz[1 << 17]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; for (int ...
replace
22
23
22
23
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; //************** StrAnge.R ********************* #define ll long long int #define ull unsigned long long #define ld long double #define lll __int128 #define vi vector<int> #define vl vector<ll> #define vvi vector<vector<int>> #define pii pair<int, int> #define piii pair<i...
#include <bits/stdc++.h> using namespace std; //************** StrAnge.R ********************* #define ll long long int #define ull unsigned long long #define ld long double #define lll __int128 #define vi vector<int> #define vl vector<ll> #define vvi vector<vector<int>> #define pii pair<int, int> #define piii pair<i...
insert
169
169
169
172
TLE
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define NMAX 100005 using namespace std; int n, k, d[NMAX], maxim, a[NMAX]; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; for (int j = 0; j <= k; j) { if (d[j] == 0) { for (int i = 1; i <= n; i++) { if (j + a[i] <= k) d[j + a[i]] = 1...
#include <bits/stdc++.h> #define NMAX 100005 using namespace std; int n, k, d[NMAX], maxim, a[NMAX]; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; for (int j = 0; j <= k; j++) { if (d[j] == 0) { for (int i = 1; i <= n; i++) { if (j + a[i] <= k) d[j + a[i]] =...
replace
8
9
8
9
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef unsigned long ul; typedef unsigned long long ull; typedef long long ll; typedef vector<ll> vint; typedef vector<vector<ll>> vvint; typedef vector<vector<vector<ll>>> vvvint; typedef vector<string> vstring; typedef vector<vector<string>> vvstring; typedef vector<cha...
#include <bits/stdc++.h> using namespace std; typedef unsigned long ul; typedef unsigned long long ull; typedef long long ll; typedef vector<ll> vint; typedef vector<vector<ll>> vvint; typedef vector<vector<vector<ll>>> vvvint; typedef vector<string> vstring; typedef vector<vector<string>> vvstring; typedef vector<cha...
insert
70
70
70
72
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define fs first #define sc second #define mp make_pair #define pb push_back #define eb emplace_back #define ALL(A) A.begin(), A.end() #define RALL(A) A.rbegin(), A.rend() typedef long LL; typedef pair<LL, LL> P; const LL mod = 1e9 + 7; const LL LINF = 1LL << 62; const int ...
#include <bits/stdc++.h> using namespace std; #define fs first #define sc second #define mp make_pair #define pb push_back #define eb emplace_back #define ALL(A) A.begin(), A.end() #define RALL(A) A.rbegin(), A.rend() typedef long LL; typedef pair<LL, LL> P; const LL mod = 1e9 + 7; const LL LINF = 1LL << 62; const int ...
replace
20
21
20
21
TLE
p03170
C++
Runtime Error
//__professor_ #include <bits/stdc++.h> #define ll long long int #define ull unsigned long long int #define lld long double #define pb push_back #define ff first #define ss second #define mk make_pair #define ub upper_bound #define lb lower_bound #define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0) #d...
//__professor_ #include <bits/stdc++.h> #define ll long long int #define ull unsigned long long int #define lld long double #define pb push_back #define ff first #define ss second #define mk make_pair #define ub upper_bound #define lb lower_bound #define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0) #d...
replace
50
53
50
55
0
p03170
C++
Runtime Error
// ######################################## LET'S DO THIS // #########################################################// /* Name: Prathamesh S Motto: To Never Give Up Linkedin: https://www.linkedin.com/in/prathamesh-shendarkar-1a3411172/ */ // ####################################### Start of Macros // ################...
// ######################################## LET'S DO THIS // #########################################################// /* Name: Prathamesh S Motto: To Never Give Up Linkedin: https://www.linkedin.com/in/prathamesh-shendarkar-1a3411172/ */ // ####################################### Start of Macros // ################...
replace
101
102
101
102
0
p03170
C++
Runtime Error
#include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <algorithm> #include <cmath> #include <fstream> #include <map> #include <set> #include <string> #include <vector> #define fastio \ ios_base::sync_with_stdio(false); ...
#include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <algorithm> #include <cmath> #include <fstream> #include <map> #include <set> #include <string> #include <vector> #define fastio \ ios_base::sync_with_stdio(false); ...
replace
153
154
153
154
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define se second #define fr first #define int long long int #define pb push_back #define inf 1e18 #define all(v) v.begin(), v.end() #define CHAL_BAAP_KO_MT_SIKHA \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; #define se second #define fr first #define int long long int #define pb push_back #define inf 1e18 #define all(v) v.begin(), v.end() #define CHAL_BAAP_KO_MT_SIKHA \ ios_base::sync_with_stdio(false); ...
replace
22
24
22
24
0
p03170
C++
Runtime Error
// #include<bits/stdc++.h> // using namespace std; // const int N = 100000, MAXI = 3, D = 1000; // int main() { // freopen("output.txt", "r", stdin); // freopen("input.txt", "w", stdout); // srand(time(nullptr)); // int tc = 10000, flag = 1; // cout << tc << "\n"; // int n = 1; // while (t...
// #include<bits/stdc++.h> // using namespace std; // const int N = 100000, MAXI = 3, D = 1000; // int main() { // freopen("output.txt", "r", stdin); // freopen("input.txt", "w", stdout); // srand(time(nullptr)); // int tc = 10000, flag = 1; // cout << tc << "\n"; // int n = 1; // while (t...
delete
49
55
49
49
0
p03170
C++
Time Limit Exceeded
// By Tushar Gautam #pragma GCC optimize("-O2") #include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
// By Tushar Gautam #pragma GCC optimize("-O2") #include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
insert
78
78
78
80
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("unroll-loops") #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)((x).size()) #define debug(x) cout << #x << ":" << x << " "; #define debugg(x) cout << #x << ":...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("unroll-loops") #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)((x).size()) #define debug(x) cout << #x << ":" << x << " "; #define debugg(x) cout << #x << ":...
replace
78
79
78
80
0
p03170
C++
Runtime Error
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; int const MAXN = 110, MAXK = 110000; int n, k, v[MAXN]; bool dp[MAXN]; int main() { cin >> n >> k; for (int i = 0; i < n; i++) cin >> v[i]; for (int i = 1; i <= k; i++) { bool possible = false; for (int j = 0; j < n && i - v[j] >...
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; int const MAXN = 110, MAXK = 110000; int n, k, v[MAXN]; bool dp[MAXK]; int main() { cin >> n >> k; for (int i = 0; i < n; i++) cin >> v[i]; for (int i = 1; i <= k; i++) { bool possible = false; for (int j = 0; j < n && i - v[j] >...
replace
5
6
5
6
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; using namespace std; #define a_macro(args...)...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; using namespace std; #define a_macro(args...)...
delete
36
42
36
36
-11
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int N, K; vector<int> a; vector<bool> dp; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> N >> K; a.resize(N); dp.resize(K + 1, false); for (int i = 0; i < N; i++) { cin >> a[i]; } for (int i = 0; i <= K; i++) {...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int N, K; vector<int> a; vector<bool> dp; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> N >> K; a.resize(N); dp.resize(K + 1, false); for (int i = 0; i < N; i++) { cin >> a[i]; } for (int i = 0; i <= K; i++) {...
replace
26
27
26
27
0
p03170
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long ll; const int N = 105; int n, k, a[N], dp[N]; int dfs(int x) { if (~dp[x]) return dp[x]; bool win = 0; for (int i = 1; i <= n; ++i) { if (x - a[i] < 0) continue; win |= (dfs(x - a...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long ll; const int N = 105, K = 1e5 + 10; int n, k, a[N], dp[K]; int dfs(int x) { if (~dp[x]) return dp[x]; bool win = 0; for (int i = 1; i <= n; ++i) { if (x - a[i] < 0) continue; win...
replace
6
8
6
8
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int dp[100001][2], a[101], n; // p = {0, 1} : {first, second} int recur(int k, bool p) { if (k < a[0]) return not p; int &ret = dp[k][p]; for (int i = 0; i < n and k - a[i] >= 0; ++i) if (recur(k - a[i], not p) == p) return ret = p; return ret = n...
#include <bits/stdc++.h> using namespace std; int dp[100001][2], a[101], n; // p = {0, 1} : {first, second} int recur(int k, bool p) { if (k < a[0]) return not p; int &ret = dp[k][p]; if (ret != -1) return ret; for (int i = 0; i < n and k - a[i] >= 0; ++i) if (recur(k - a[i], not p) == p) ...
insert
12
12
12
15
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int dp[100009]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; int arr[n + 1]; for (int i = 0; i < n; i++) { cin >> arr[i]; dp[arr[i]] = 1; } for (int i = 0; i < arr[0]; i++) dp[i] = 0; int fl...
#include <bits/stdc++.h> using namespace std; int dp[100009]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; int arr[n + 1]; for (int i = 0; i < n; i++) { cin >> arr[i]; dp[arr[i]] = 1; } for (int i = 0; i < arr[0]; i++) dp[i] = 0; int fl...
replace
20
21
20
21
0
p03170
C++
Runtime Error
// 参考:https://blog.csdn.net/HQG_AC/article/details/85984085 // 记忆化优点:https://blog.csdn.net/u011639256/article/details/29389951 #include <bits/stdc++.h> using namespace std; const int maxn = 110; int n, k; int a[maxn], dp[maxn][2]; // dp[容量][人]记录是否能赢 // 记忆化搜索初始化必须可以实现判断是否记忆 // 记忆化好处:从上往下递归,但是不用吧中途的所有情况都记下来,只需要用到递归到的状态的...
// 参考:https://blog.csdn.net/HQG_AC/article/details/85984085 // 记忆化优点:https://blog.csdn.net/u011639256/article/details/29389951 #include <bits/stdc++.h> using namespace std; const int maxn = 110; int n, k; int a[maxn], dp[100005][2]; // dp[容量][人]记录是否能赢 // 记忆化搜索初始化必须可以实现判断是否记忆 // 记忆化好处:从上往下递归,但是不用吧中途的所有情况都记下来,只需要用到递归到的状...
replace
7
8
7
8
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int dp[100000 + 5]; int A[100 + 5]; int main(int argc, char const *argv[]) { int N, K; while (cin >> N >> K) { memset(dp, 0, sizeof(dp)); for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = A[0]; i <= K; i++) { for (int j = 0; j < N; j...
#include <bits/stdc++.h> using namespace std; int dp[100000 + 5]; int A[100 + 5]; int main(int argc, char const *argv[]) { int N, K; while (cin >> N >> K) { memset(dp, 0, sizeof(dp)); for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = A[0]; i <= K; i++) { for (int j = 0; j < N; j...
replace
14
15
14
15
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; constexpr int MAXN = 107, MAXK = 1e1 + 7; int n, k; int lst[MAXN], dp[MAXK]{-1}; int winner(int rem) { if (dp[rem]) return dp[rem]; bool canwin = false; for (int i = 0; i != n; ++i) if (lst[i] <= rem && winner(rem - lst[i]) == -1) { canwin = true; ...
#include <bits/stdc++.h> using namespace std; constexpr int MAXN = 107, MAXK = 1e5 + 7; int n, k; int lst[MAXN], dp[MAXK]{-1}; int winner(int rem) { if (dp[rem]) return dp[rem]; bool canwin = false; for (int i = 0; i != n; ++i) if (lst[i] <= rem && winner(rem - lst[i]) == -1) { canwin = true; ...
replace
2
3
2
3
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int func(vector<int> arr, int n, int k, int minv) { vector<int> dp(k + 1, 1); for (int i = 0; i < minv; i++) dp[i] = 0; for (int i = minv; i <= k; i++) { for (int p = 0; p < n; p++) { int rem = i - arr[p]; dp[i] = dp[i] & dp[rem]; // if(dp...
#include <bits/stdc++.h> using namespace std; int func(vector<int> arr, int n, int k, int minv) { vector<int> dp(k + 1, 1); for (int i = 0; i < minv; i++) dp[i] = 0; for (int i = minv; i <= k; i++) { for (int p = 0; p < n; p++) { if (arr[p] <= i) { int rem = i - arr[p]; dp[i] = dp...
replace
11
14
11
16
0
p03170
C++
Runtime Error
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack...
replace
35
36
35
36
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define faster \ cin.tie(0); \ ios_base::sync_with_stdio(0) #define ll long long // # setprecision doubt int n, k; int main() { int temp;...
#include <bits/stdc++.h> using namespace std; #define faster \ cin.tie(0); \ ios_base::sync_with_stdio(0) #define ll long long // # setprecision doubt int n, k; int main() { int temp;...
replace
22
23
22
23
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define IOS \ ; \ ios::sync_with_stdio(0); \ cin.tie...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define IOS \ ; \ ios::sync_with_stdio(0); \ cin.tie...
replace
8
9
8
9
0
p03170
C++
Runtime Error
#include <iomanip> #include <iostream> #include <vector> using namespace std; int n, k; vector<int> a; int dp[10010]; // 石がx個残っている場合の勝ち負けを判断、0の場合負け int main() { cin >> n >> k; a.resize(n); for (int i = 0; i < n; ++i) cin >> a[i]; // dp[0] = 0; //残りの石が0個の場合負け for (int i = 0; i <= k; ++i) { for (int ...
#include <iomanip> #include <iostream> #include <vector> using namespace std; int n, k; vector<int> a; int dp[100010]; // 石がx個残っている場合の勝ち負けを判断、0の場合負け int main() { cin >> n >> k; a.resize(n); for (int i = 0; i < n; ++i) cin >> a[i]; // dp[0] = 0; //残りの石が0個の場合負け for (int i = 0; i <= k; ++i) { for (int...
replace
6
7
6
7
0
p03170
C++
Runtime Error
// #pragma GCC optimize("Ofast") // #pragma GCC optimize ("unroll-loops") // #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define mod 998244353 #define fi first #define se second #define pii pair<int...
// #pragma GCC optimize("Ofast") // #pragma GCC optimize ("unroll-loops") // #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define mod 998244353 #define fi first #define se second #define pii pair<int...
replace
40
41
40
41
-11
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long using namespace std; const int NM = 1e5; int v[105]; bool dp[NM]; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> v[i]; /// dp[i]=1, daca sunt i pietre si primul jucator castiga for (int j = 0; j <= k; j++) for (int i = 1; i <=...
#include <bits/stdc++.h> #define ll long long using namespace std; const int NM = 1e5; int v[105]; bool dp[NM]; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> v[i]; /// dp[i]=1, daca sunt i pietre si primul jucator castiga for (int j = 0; j <= k; j++) for (int i = 1; i <=...
replace
17
18
17
18
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define ii pair<int, int> #define all(x) (x).begin(), (x).end() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie...
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define ii pair<int, int> #define all(x) (x).begin(), (x).end() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie...
replace
18
19
18
19
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, k, dp[105][2]; int a[105]; bool dfs(int k, int t) { if (dp[k][t] >= 0) return dp[k][t]; int ans = 0; for (int i = 1; i <= n; i++) if (k >= a[i]) ans |= !dfs(k - a[i], !t); return dp[k][t] = ans; } int main() { memset(dp, -1, sizeof(dp)); sca...
#include <bits/stdc++.h> using namespace std; int n, k, dp[1000005][2]; int a[10000005]; bool dfs(int k, int t) { if (dp[k][t] >= 0) return dp[k][t]; int ans = 0; for (int i = 1; i <= n; i++) if (k >= a[i]) ans |= !dfs(k - a[i], !t); return dp[k][t] = ans; } int main() { memset(dp, -1, sizeof(dp...
replace
2
4
2
4
0
p03170
C++
Runtime Error
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /0 ___/`---'\___ .' \\| |// '. / \\||| : |||// \ / _||||| -:- |||||- \ ...
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /0 ___/`---'\___ .' \\| |// '. / \\||| : |||// \ / _||||| -:- |||||- \ ...
delete
95
98
95
95
-11
p03170
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define pll pair<ll, ll> #define F first #define S second #define pb push_back #define ld long double #define vll vector<ll> #define vpll vector<...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define pll pair<ll, ll> #define F first #define S second #define pb push_back #define ld long double #define vll vector<ll> #define vpll vector<...
insert
55
55
55
57
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define inf (long long)1e18 using namespace std; int n, k, a[101]; bool dp[100001]; int main() { scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 0; i < k; i++) if (!dp[i]) { // losing position for (int j = 0; j < n; j++) dp[i + a[j...
#include <bits/stdc++.h> #define inf (long long)1e18 using namespace std; int n, k, a[101]; bool dp[100001]; int main() { scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 0; i < k; i++) if (!dp[i]) { // losing position for (int j = 0; j < n; j++) if (i + a[...
replace
12
13
12
14
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = (0); i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(x) (x).begin(), (x).end() #define rrng(x) (x).rbegin(), (x).rend() #define limit(...
#include <bits/stdc++.h> #define rep(i, n) for (int i = (0); i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(x) (x).begin(), (x).end() #define rrng(x) (x).rbegin(), (x).rend() #define limit(...
replace
89
90
89
90
0
p03170
C++
Runtime Error
/* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cmath> #include <numeric> #include <random> // container library #include <array> #include <bitset> #include <deque> #i...
/* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cmath> #include <numeric> #include <random> // container library #include <array> #include <bitset> #include <deque> #i...
replace
63
64
63
64
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define rep(i, n) for (ll i = 0; i < n; i++) #define rep1(i, n) for (ll i = 1; i <= n; i++) #define mp make_pair #define F first #define S second #define pf pop_front #define IOS \ ios...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define rep(i, n) for (ll i = 0; i < n; i++) #define rep1(i, n) for (ll i = 1; i <= n; i++) #define mp make_pair #define F first #define S second #define pf pop_front #define IOS \ ios...
replace
14
15
14
15
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int const int MOD = 1e9 + 7; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; int dp[k + 1]; vector<int> v; for (int i = 0; i <= k; i++) dp[i] = 0; for (int i = 1; i <= n; i++) { int last_elemen...
#include <bits/stdc++.h> #define ll long long int const int MOD = 1e9 + 7; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; int dp[k + 1]; vector<int> v; for (int i = 0; i <= k; i++) dp[i] = 0; for (int i = 1; i <= n; i++) { int last_elemen...
replace
22
23
22
24
0
p03170
C++
Runtime Error
#include <iostream> using namespace std; const int N(109); int n, m, k, ans; int a[N]; int f[N][2]; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 0; i <= k; i++) { for (int j = 0; j < 2; j++) { for (int l = 1; l <= n; l++) { if (i >= a[l] && !f[...
#include <iostream> using namespace std; const int N(109); int n, m, k, ans; int a[N]; int f[100005][2]; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 0; i <= k; i++) { for (int j = 0; j < 2; j++) { for (int l = 1; l <= n; l++) { if (i >= a[l] &...
replace
8
9
8
9
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define sf(n) scanf("%lld", &n) #define sff(n, m) scanf("%lld %lld", &n, &m) #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0);...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define sf(n) scanf("%lld", &n) #define sff(n, m) scanf("%lld %lld", &n, &m) #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0);...
replace
16
17
16
17
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, k; int a[100]; int dp[100001][2]; // dp[number of remain stone][player id] = winner // {player id : {First: 0, Second: 1}} // {winner : {0: First, 1: Second, -1: unknown}} int dfs(int stones, int player) { if (dp[stones][player] != -1) return dp[stones][player...
#include <bits/stdc++.h> using namespace std; int n, k; int a[100]; int dp[100001][2]; // dp[number of remain stone][player id] = winner // {player id : {First: 0, Second: 1}} // {winner : {0: First, 1: Second, -1: unknown}} int dfs(int stones, int player) { if (dp[stones][player] != -1) return dp[stones][player...
replace
14
16
14
18
0
p03170
C++
Runtime Error
#include <cstdio> #include <iostream> using namespace std; int n, k; int a[110]; bool f[10010]; int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; ++i) scanf("%d", &a[i]); for (int i = 1; i <= k; ++i) for (int j = 1; j <= n && a[j] <= i; ++j) if (!f[i - a[j]]) { f[i] = 1; ...
#include <cstdio> #include <iostream> using namespace std; int n, k; int a[110]; bool f[100010]; int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; ++i) scanf("%d", &a[i]); for (int i = 1; i <= k; ++i) for (int j = 1; j <= n && a[j] <= i; ++j) if (!f[i - a[j]]) { f[i] = 1; ...
replace
7
8
7
8
0
p03170
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <climits> #include <iostream> #include <map> #include <math.h> #include <stack> #include <string.h> #include <unordered_map> #include <vector> using namespace std; const int INF = 1e9; #define ll long long #define int ll #define fast ...
#include <algorithm> #include <bits/stdc++.h> #include <climits> #include <iostream> #include <map> #include <math.h> #include <stack> #include <string.h> #include <unordered_map> #include <vector> using namespace std; const int INF = 1e9; #define ll long long #define int ll #define fast ...
replace
100
101
100
101
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define db1(x) cout << #x << "=" << x << '\n' #define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << '\n' #define db3(x, y, z) \ cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \ << '\...
#include <bits/stdc++.h> #define db1(x) cout << #x << "=" << x << '\n' #define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << '\n' #define db3(x, y, z) \ cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \ << '\...
replace
21
22
21
22
0
p03170
C++
Runtime Error
#include "bits/stdc++.h" #include <random> using namespace std; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld; #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define POW2(n) (1LL << (n)) #define FOR(i, begin, end) ...
#include "bits/stdc++.h" #include <random> using namespace std; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld; #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define POW2(n) (1LL << (n)) #define FOR(i, begin, end) ...
replace
51
52
51
52
0
p03170
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; #define PIGRECO 3.141592653589793 #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operato...
#include "bits/stdc++.h" using namespace std; #define PIGRECO 3.141592653589793 #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operato...
replace
54
55
54
55
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long unsigned int ll; // definition {{{ 1 // scaning {{{ 2 #define Scd(x) scanf("%d", &x) #define Scd2(x, y) scanf("%d%d", &x, &y) #define Scd3(x, y, z) scanf("%d%d%d", &x, &y, &z) #define Scll(x) scanf("%llu", &x) #define Scll2(x, y) scanf("%llu%llu", &x, &...
#include <bits/stdc++.h> using namespace std; typedef long long unsigned int ll; // definition {{{ 1 // scaning {{{ 2 #define Scd(x) scanf("%d", &x) #define Scd2(x, y) scanf("%d%d", &x, &y) #define Scd3(x, y, z) scanf("%d%d%d", &x, &y, &z) #define Scll(x) scanf("%llu", &x) #define Scll2(x, y) scanf("%llu%llu", &x, &...
replace
43
44
43
44
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); long long int dp[k + 1]; dp[0] = 0; for (int i = 1; i <= k; i++) { if (i < a[0]) dp[i] = 0; for (int j = 0; j <= n; j++) { if (j...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); long long int dp[k + 1]; dp[0] = 0; for (int i = 1; i <= k; i++) { if (i < a[0]) dp[i] = 0; else { for (int j = 0; j <= n; j++) ...
replace
15
23
15
28
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define FOR(v, a, b) for (int v = (a); v < (b); ++v) #define FORE(v, a, b) for (int v = (a); v <= (b); ++v) #define REP(v, n) FOR(v, 0, n) #define REPE(v, n) FORE(v, 0, n) #define REV(v, a, b) for (int v = (a); v >= (b); --v) #define ALL(x) (x).begin(), (x).end() #define ITR(it, c) for (auto it...
#include <bits/stdc++.h> #define FOR(v, a, b) for (int v = (a); v < (b); ++v) #define FORE(v, a, b) for (int v = (a); v <= (b); ++v) #define REP(v, n) FOR(v, 0, n) #define REPE(v, n) FORE(v, 0, n) #define REV(v, a, b) for (int v = (a); v >= (b); --v) #define ALL(x) (x).begin(), (x).end() #define ITR(it, c) for (auto it...
insert
71
71
71
72
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define taskname "" #define pb push_back #define eb emplace_back #define fi first #define se second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define for0(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #defin...
#include <bits/stdc++.h> #define taskname "" #define pb push_back #define eb emplace_back #define fi first #define se second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define for0(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #defin...
replace
42
43
42
47
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, n, imin = 0; int minn = INT_MAX; int maxx = INT_MIN; cin >> n >> k; int dp[k + 1]; int arr[n]; for (i = 0; i <= k; i++) { dp[i] = 1; } for (i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] < minn) { imin = i; ...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, n, imin = 0; int minn = INT_MAX; int maxx = INT_MIN; cin >> n >> k; int dp[k + 1]; int arr[n]; for (i = 0; i <= k; i++) { dp[i] = 1; } for (i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] < minn) { imin = i; ...
replace
23
24
23
24
0
p03170
C++
Runtime Error
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<bool> dp(k + 1, false); vector<int> a(...
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<bool> dp(k + 1, false); vector<int> a(...
replace
26
27
26
27
0