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> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) const char sp = ' '; const char cmm = ','; const int MOD = 1000000007; using ll = long long; ll mod(ll a, ll b) { return (a % b + b) % b; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) const char sp = ' '; const char cmm = ','; const int MOD = 1000000007; using ll = long long; ll mod(ll a, ll b) { return (a % b + b) % b; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return ...
replace
52
53
52
53
0
p03170
C++
Runtime Error
#include <cstdint> #include <cstdio> #include <vector> int main() { size_t N, K; scanf("%zu %zu", &N, &K); std::vector<size_t> a(N); for (auto &ai : a) scanf("%zu", &ai); std::vector<size_t> dp(K + 1, 0); for (size_t i = 0; i < K; ++i) for (size_t j = 0; j < N; ++j) { if (dp[i + a[j]] > K) ...
#include <cstdint> #include <cstdio> #include <vector> int main() { size_t N, K; scanf("%zu %zu", &N, &K); std::vector<size_t> a(N); for (auto &ai : a) scanf("%zu", &ai); std::vector<size_t> dp(K + 1, 0); for (size_t i = 0; i < K; ++i) for (size_t j = 0; j < N; ++j) { if (i + a[j] > K) ...
replace
15
16
15
16
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair<int, int> pii; typedef vector<ll> vll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<vector<ll>> vvll; const ll inf = 1e16; const ll md = 1000000007; bool stone[105]...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair<int, int> pii; typedef vector<ll> vll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<vector<ll>> vvll; const ll inf = 1e16; const ll md = 1000000007; bool stone[1000...
replace
11
12
11
12
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; void Fast() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main() { Fast(); int n, i, k; cin >> n >> k; int *v = new int[n]; bool **dp = new bool *[k]; for (i = 0; i <= k; i++) dp[i] = new bool[2]; for (i = 0; i < n; i++) cin...
#include <bits/stdc++.h> using namespace std; void Fast() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main() { Fast(); int n, i, k; cin >> n >> k; int *v = new int[n]; bool **dp = new bool *[k + 1]; for (i = 0; i <= k; i++) dp[i] = new bool[2]; for (i = 0; i < n; i++) ...
replace
12
13
12
13
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define pii pair<int, int> #define in freopen("input.txt", "r", stdin) #define out freopen("output.txt", "w", stdout) #define rep(i, n) for (long long int(i) = 0; (i) < (n); ++(i)) #define ref(i, a, b) for (...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define pii pair<int, int> #define in freopen("input.txt", "r", stdin) #define out freopen("output.txt", "w", stdout) #define rep(i, n) for (long long int(i) = 0; (i) < (n); ++(i)) #define ref(i, a, b) for (...
replace
15
16
15
16
0
p03170
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <string> #include <tuple> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) #define ALL(x) x.begin(),...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <string> #include <tuple> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) #define ALL(x) x.begin(),...
replace
26
27
26
27
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int dp[100001]; int main() { freopen("final_input.txt", "r", stdin); int n; cin >> n; int k; cin >> k; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; dp[arr[i]] = 1; } dp[0] = 0; for (int i = 1; i <= k; i++) { for (int j = 0; j < n...
#include <bits/stdc++.h> using namespace std; int dp[100001]; int main() { // freopen("final_input.txt", "r", stdin); int n; cin >> n; int k; cin >> k; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; dp[arr[i]] = 1; } dp[0] = 0; for (int i = 1; i <= k; i++) { for (int j = 0; j ...
replace
4
5
4
5
-11
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; void solve(); int main() { // freopen("SNOOKER.inp","r",stdin); // freopen("SNOOKER.out","w",stdout); ios_base::sync_with_stdio(false); cin.tie(nullptr); solve(); } using ll = long long; #define endl "\n" #define eb emplace_back #define all(x) x.begin(), x.end() ...
#include <bits/stdc++.h> using namespace std; void solve(); int main() { // freopen("SNOOKER.inp","r",stdin); // freopen("SNOOKER.out","w",stdout); ios_base::sync_with_stdio(false); cin.tie(nullptr); solve(); } using ll = long long; #define endl "\n" #define eb emplace_back #define all(x) x.begin(), x.end() ...
replace
40
41
40
41
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FLASH \ cin.tie(0); \ cout.tie(0); ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FLASH \ cin.tie(0); \ cout.tie(0); ...
replace
25
28
25
26
-11
p03170
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <stdio.h> using namespace std; using namespace __gnu_pbds; #define ll long long typedef pair<int, int> pii; #define MOD 1000000007 #define MOD1 998244353 #define ff first #define ss second #define bn cout << ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <stdio.h> using namespace std; using namespace __gnu_pbds; #define ll long long typedef pair<int, int> pii; #define MOD 1000000007 #define MOD1 998244353 #define ff first #define ss second #define bn cout << ...
delete
120
125
120
120
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define fi first #define se second int n, k, a[107]; bool dp[100007], vis[100007]; bool solve(int rem) { if (vis[rem]) return dp[rem]; bool ret = false; for (int i = 1; i <= n; i++) { if (a[i] > rem) continue; ...
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define fi first #define se second int n, k, a[107]; bool dp[100007], vis[100007]; bool solve(int rem) { if (vis[rem]) return dp[rem]; vis[rem] = true; bool ret = false; for (int i = 1; i <= n; i++) { if (a[i] > re...
insert
13
13
13
14
TLE
p03170
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; #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 operator<<( \ c i) { sim > ...
#include "bits/stdc++.h" using namespace std; #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 operator<<( \ c i) { sim > ...
replace
60
61
60
61
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define REP(i, m, n) for (int i = (m); i < (n); i++) #define rep(i, n) REP(i, 0, n) #define pb push_back #define all(a) a.begin(), a.end() #define rall(c) (c).rbegin(), (c).rend() #define mp make_pair #define double long dou...
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define REP(i, m, n) for (int i = (m); i < (n); i++) #define rep(i, n) REP(i, 0, n) #define pb push_back #define all(a) a.begin(), a.end() #define rall(c) (c).rbegin(), (c).rend() #define mp make_pair #define double long dou...
insert
39
39
39
40
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1e9 + 5; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int n; cin >> n; int k; cin >> k; int a[n + 1]; for (int i = 1; i <= ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1e9 + 5; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int n; cin >> n; int k; cin >> k; int a[n + 1]; for (int i = 1; i <= ...
replace
17
18
17
18
0
p03170
C++
Runtime Error
/******************************** * AUTHOR: ARNAB SEN * * NICK : arnab1729 * * INSTITUTION: IIEST, SHIBPUR * ********************************/ #include <bits/stdc++.h> using namespace std; typedef string STR; typedef long long LL; typedef long double LD; typedef unsigned long long U...
/******************************** * AUTHOR: ARNAB SEN * * NICK : arnab1729 * * INSTITUTION: IIEST, SHIBPUR * ********************************/ #include <bits/stdc++.h> using namespace std; typedef string STR; typedef long long LL; typedef long double LD; typedef unsigned long long U...
replace
132
133
132
133
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> Pii; typedef pair<ll, ll> Pll; #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep2(i, a, b) for (ll i = a; i < b; ++i) const ll MOD = 1000003; const ll INF = 1e9; const ll IINF = 1e18; const double EPS = 1e-8; const double ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> Pii; typedef pair<ll, ll> Pll; #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep2(i, a, b) for (ll i = a; i < b; ++i) const ll MOD = 1000003; const ll INF = 1e9; const ll IINF = 1e18; const double EPS = 1e-8; const double ...
replace
36
37
36
41
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = double; #define fi first #define se second #define pb push_back #define eb emplace_back #define all(v) (v).begin(), (v).end() #define siz(v) (ll)(v).size() #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define repi(i, x, n) for (ll i = ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = double; #define fi first #define se second #define pb push_back #define eb emplace_back #define all(v) (v).begin(), (v).end() #define siz(v) (ll)(v).size() #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define repi(i, x, n) for (ll i = ...
replace
20
21
20
21
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second #define pii pair<int, int> #define eb emplace_back #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep3(i, l, n) for (int i = l; i < (n); ++i) #define sz(v) (int)v.size() const ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second #define pii pair<int, int> #define eb emplace_back #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep3(i, l, n) for (int i = l; i < (n); ++i) #define sz(v) (int)v.size() const ...
replace
86
87
86
87
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ll lo...
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ll lo...
replace
45
46
45
46
0
p03170
C++
Runtime Error
/* confirm 0LL and 1LL confirm cornercases such as 0 confirm times of cin < 10^6 */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; using Pld = pair<ld, ld>; using Vec = vector<ll>; using VecP = vector<P>; using VecB = vector<bool>; using VecC = vector...
/* confirm 0LL and 1LL confirm cornercases such as 0 confirm times of cin < 10^6 */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; using Pld = pair<ld, ld>; using Vec = vector<ll>; using VecP = vector<P>; using VecB = vector<bool>; using VecC = vector...
replace
94
97
94
101
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 10; int dp[MAX]; int main() { int N, K, i, j; cin >> N >> K; int a[N]; int flag; for (i = 0; i < N; i++) cin >> a[i]; for (i = 0; i < a[0]; i++) dp[i] = -1; for (i = a[0]; i < K + 1; i++) { flag = 0; for (j = 0; j < N; j+...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 10; int dp[MAX]; int main() { int N, K, i, j; cin >> N >> K; int a[N]; int flag; for (i = 0; i < N; i++) cin >> a[i]; for (i = 0; i < a[0]; i++) dp[i] = -1; for (i = a[0]; i < K + 1; i++) { flag = 0; for (j = 0; j < N; j+...
replace
17
18
17
20
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse2") /* |||||||||||||||||||||||||||||||||||||||||||||||| | ||| | |||| |||| | | | | | | | | | | | | | | | | | | | | | | | | ...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse2") /* |||||||||||||||||||||||||||||||||||||||||||||||| | ||| | |||| |||| | | | | | | | | | | | | | | | | | | | | | | | | ...
replace
99
102
99
100
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03170
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define pb push_back #define ins insert #define pob pop_back #define er erase #define emp empty #define f first #define s second #define ff f.f #define fs f.s ...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define pb push_back #define ins insert #define pob pop_back #define er erase #define emp empty #define f first #define s second #define ff f.f #define fs f.s ...
replace
34
35
34
35
0
p03170
C++
Time Limit Exceeded
/** *COYG, 14 FA Cups we are back baby */ #include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define ll long long #define mp make_pair #define pb push_back #define forn(i, n) for (int i = 0; i < n; i++) #define for1(i, n) for (int i = 1; i < n; i++) #define ford(i, n) for (int i = n - 1; i >= 0; i--...
/** *COYG, 14 FA Cups we are back baby */ #include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define ll long long #define mp make_pair #define pb push_back #define forn(i, n) for (int i = 0; i < n; i++) #define for1(i, n) for (int i = 1; i < n; i++) #define ford(i, n) for (int i = n - 1; i >= 0; i--...
insert
43
43
43
44
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)n; i++) bool dp[100010]; int main() { int N, K; cin >> N >> K; vector<int> a(N); rep(i, N) cin >> a[i]; memset(dp, 0, sizeof(dp)); for (int i = 0; i <= K; i++) { if (dp[i]) continue; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)n; i++) bool dp[100010]; int main() { int N, K; cin >> N >> K; vector<int> a(N); rep(i, N) cin >> a[i]; memset(dp, 0, sizeof(dp)); for (int i = 0; i <= K; i++) { if (dp[i]) continue; ...
insert
19
19
19
21
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[n + 1]; for (int i = 0; i < n; i++) cin >> a[i]; bool dp[k + 1]; memset(dp, 0, sizeof(dp)); for (int i = 1; i <= k; i++) { for (int val : a) { if (val > i) continue; if (dp[i - val] ==...
#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]; bool dp[k + 1]; memset(dp, 0, sizeof(dp)); for (int i = 1; i <= k; i++) { for (int val : a) { if (val > i) continue; if (dp[i - val] == 0) ...
replace
6
7
6
7
-11
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ln '\n' #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define FOR(i, a, b) for (int i = (a); i <= (int)(b); ++i) #define FORR(i, a, b) for (int i = (a); i >= (int)(b); --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector<int> VI; ...
#include <bits/stdc++.h> using namespace std; #define ln '\n' #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define FOR(i, a, b) for (int i = (a); i <= (int)(b); ++i) #define FORR(i, a, b) for (int i = (a); i >= (int)(b); --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector<int> VI; ...
replace
28
31
28
35
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<bool> dp(n + 5); for (int stone = 0; stone <= k; stone++) { for (int x : a) // Foreach stones in array a ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<bool> dp(k + 5); for (int stone = 0; stone <= k; stone++) { for (int x : a) // Foreach stones in array a ...
replace
12
13
12
13
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define pii pair<ll, ll> #define piii pair<ll, pii> #define MOD 1000000007 #define M 105 #define N 100005 #define inf 1000000001 using namespace std; ll n, k; ll arr[M], dp[M]; // k void solve() { // 0 means 2nd player and 1 means 1st player // if there is no element i...
#include <bits/stdc++.h> #define ll long long #define pii pair<ll, ll> #define piii pair<ll, pii> #define MOD 1000000007 #define M 105 #define N 100005 #define inf 1000000001 using namespace std; ll n, k; ll arr[M], dp[N]; // k void solve() { // 0 means 2nd player and 1 means 1st player // if there is no element i...
replace
10
11
10
11
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define FASTIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout....
#include <bits/stdc++.h> using namespace std; #define ll long long #define FASTIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout....
replace
11
13
11
12
0
p03170
C++
Runtime Error
/* Educational DP Contest - K - Stones https://atcoder.jp/contests/dp/tasks/dp_k */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vii; typed...
/* Educational DP Contest - K - Stones https://atcoder.jp/contests/dp/tasks/dp_k */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vii; typed...
replace
81
82
81
82
0
p03170
C++
Time Limit Exceeded
/* Educational DP Contest - K - Stones https://atcoder.jp/contests/dp/tasks/dp_k */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vii; typed...
/* Educational DP Contest - K - Stones https://atcoder.jp/contests/dp/tasks/dp_k */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vii; typed...
replace
82
84
82
86
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define ll_s long #define mod 1000000007 #define forn(i, start, lim) for (ll i = start; i < lim; i++) #define forn_d(i, start, lim) for (ll i = start; i >= lim; i--) #define f first #define s second #define pb push_back #define pf push_front #define mp ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ll_s long #define mod 1000000007 #define forn(i, start, lim) for (ll i = start; i < lim; i++) #define forn_d(i, start, lim) for (ll i = start; i >= lim; i--) #define f first #define s second #define pb push_back #define pf push_front #define mp ...
replace
41
42
41
45
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<int> arr; int n, k, temp; int dp[10002]; void solve() { memset(dp, -1, sizeof dp); cin >> n >> k; for (int i = 0; i < n; i++) { cin >> temp; arr.push_back(temp); } dp[0] = 0; for (int i = 1; i <= k; i++) { dp[i] = 0; for (auto moves : ar...
#include <bits/stdc++.h> using namespace std; vector<int> arr; int n, k, temp; int dp[100002]; void solve() { memset(dp, -1, sizeof dp); cin >> n >> k; for (int i = 0; i < n; i++) { cin >> temp; arr.push_back(temp); } dp[0] = 0; for (int i = 1; i <= k; i++) { dp[i] = 0; for (auto moves : a...
replace
4
5
4
5
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define rep(a, n) for (ll a = 0; a < (n); ++a) using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef vector<vector<ll>> Graph; 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(T ...
#include <bits/stdc++.h> #define rep(a, n) for (ll a = 0; a < (n); ++a) using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef vector<vector<ll>> Graph; 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(T ...
replace
27
28
27
28
0
p03170
C++
Time Limit Exceeded
#include <iostream> using namespace std; int n, k; int a[110]; bool vis[100100][2]; bool dp[100100][2]; bool check(int x, int p) { if (x < 0) return true; if (vis[x][p]) return dp[x][p]; for (int i = 0; i < n; i++) { if (!check(x - a[i], !p)) dp[x][p] = true; } return dp[x][p]; } int main() ...
#include <iostream> using namespace std; int n, k; int a[110]; bool vis[100100][2]; bool dp[100100][2]; bool check(int x, int p) { if (x < 0) return true; if (vis[x][p]) return dp[x][p]; vis[x][p] = true; for (int i = 0; i < n; i++) { if (!check(x - a[i], !p)) dp[x][p] = true; } return dp[...
insert
11
11
11
12
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // dp[i] - 1 if first player can win with i stones, 0 otherwise int N, K, a[105]; bool dp[10005]; int main() { cin >> N >> K; for (int i = 0; i < N; i++) { cin >> a[i]; } dp[0] = 0; for (int i = 1; i <= K; i++) { bool find = false; for (int j = 0; j ...
#include <bits/stdc++.h> using namespace std; // dp[i] - 1 if first player can win with i stones, 0 otherwise int N, K, a[105]; bool dp[100005]; int main() { cin >> N >> K; for (int i = 0; i < N; i++) { cin >> a[i]; } dp[0] = 0; for (int i = 1; i <= K; i++) { bool find = false; for (int j = 0; j...
replace
5
6
5
6
0
p03170
C++
Runtime Error
#pragma GCC optimize("Ofast") #include "bits/stdc++.h" using namespace std; typedef long int li; typedef long double ld; typedef long long ll; typedef pair<int, int> pt; #define fi first #define se second #define dump(x) cout << #x << " = " << x << endl #define fastIO ...
#pragma GCC optimize("Ofast") #include "bits/stdc++.h" using namespace std; typedef long int li; typedef long double ld; typedef long long ll; typedef pair<int, int> pt; #define fi first #define se second #define dump(x) cout << #x << " = " << x << endl #define fastIO ...
insert
34
34
34
36
0
p03170
C++
Runtime Error
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef long long unsigned int ...
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef long long unsigned int ...
replace
49
50
49
51
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int n, k; cin >> n >> k; vector<int> dp(k + 1, 0), arr(n); for (int i = 0; i < n; i += 1) { cin >> arr[i]; } for (int i = 0; i <= k; i += 1) { if (dp[i] == 0) { for (int j = 0; j < n; j += 1) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int n, k; cin >> n >> k; vector<int> dp(k + 1, 0), arr(n); for (int i = 0; i < n; i += 1) { cin >> arr[i]; } for (int i = 0; i <= k; i += 1) { if (dp[i] == 0) { for (int j = 0; j < n; j += 1) { ...
replace
25
26
25
29
0
p03170
C++
Runtime Error
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> typedef long long ll; const ll mod = 1e9 + 7; #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define rc(x) return cout << x << "\n", 0 #define sz(s) (int)s.size() #define pb push_back #define mp make_pair #define fr first #define sc secon...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> typedef long long ll; const ll mod = 1e9 + 7; #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define rc(x) return cout << x << "\n", 0 #define sz(s) (int)s.size() #define pb push_back #define mp make_pair #define fr first #define sc secon...
replace
19
20
19
20
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define fr first #define sc second typedef long long ll; typedef double ld; typedef pair<int, int> p2; typedef pair<p2, int> p3; typedef vector<ll> vi; const ll Mod = 7 + 1e9; const ll INF32 = 5 + 2e9; const ll INF64 = 1 + 1e18; const ll MAX = 5 + 100; int N, K, a[MAX], dp...
#include <bits/stdc++.h> using namespace std; #define fr first #define sc second typedef long long ll; typedef double ld; typedef pair<int, int> p2; typedef pair<p2, int> p3; typedef vector<ll> vi; const ll Mod = 7 + 1e9; const ll INF32 = 5 + 2e9; const ll INF64 = 1 + 1e18; const ll MAX = 5 + 100; int N, K, a[MAX], dp...
replace
14
15
14
15
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll dp[100005] = {}; int main() { std::ios::sync_with_stdio(false); ll n, k; cin >> n >> k; vector<ll> v; for (int i = 0; i < n; i++) { ll num; cin >> num; v.push_back(num); } for (int i = 1; i <= k; i++) { for (int j = 0; ...
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll dp[100005] = {}; int main() { std::ios::sync_with_stdio(false); ll n, k; cin >> n >> k; vector<ll> v; for (int i = 0; i < n; i++) { ll num; cin >> num; v.push_back(num); } for (int i = 1; i <= k; i++) { for (int j = 0; ...
replace
16
18
16
20
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, k; // how many stones are left bool dp[100005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i <= k; i++) { for (int j = ...
#include <bits/stdc++.h> using namespace std; int n, k; // how many stones are left bool dp[100005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i <= k; i++) { for (int j = ...
replace
16
17
16
17
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define boost_io \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define debug(x) cout << #x << ":" << ...
#include <bits/stdc++.h> #define boost_io \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define debug(x) cout << #x << ":" << ...
replace
33
34
33
34
0
p03170
C++
Runtime Error
/*==============================================*\ ID: shahidul_brur Name: Md. Shahidul Islam Study: CSE, BRUR Address: Rangpur, Bangladesh mail: shahidul.cse.brur@gmail.com FB : fb.com/shahidul.brur Blog: shahidul-brur.blogspot.com(in Bengali), shahidul-brur-en.blogspot.com(in English) ...
/*==============================================*\ ID: shahidul_brur Name: Md. Shahidul Islam Study: CSE, BRUR Address: Rangpur, Bangladesh mail: shahidul.cse.brur@gmail.com FB : fb.com/shahidul.brur Blog: shahidul-brur.blogspot.com(in Bengali), shahidul-brur-en.blogspot.com(in English) ...
replace
50
51
50
51
0
p03170
C++
Runtime Error
//-----by LY02------------------------------------ #include <bits/stdc++.h> using namespace std; #define endl '\n' #define M 1000000007 //------------------------------------------------ int st[110]; int dp[100010]; //------------------------------------------------ int main() { //----------------------------------...
//-----by LY02------------------------------------ #include <bits/stdc++.h> using namespace std; #define endl '\n' #define M 1000000007 //------------------------------------------------ int st[110]; int dp[100010]; //------------------------------------------------ int main() { //----------------------------------...
replace
27
28
27
28
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int, int> pt; typedef pair<ll, ll> pll; #define Max 1000001 #define intinf 2147483647 #define longlonginf 9223372036854775807 #define MOD 998244353 #define MOD2 1000000007 #de...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int, int> pt; typedef pair<ll, ll> pll; #define Max 1000001 #define intinf 2147483647 #define longlonginf 9223372036854775807 #define MOD 998244353 #define MOD2 1000000007 #de...
replace
66
67
66
68
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> // [PRIMES] 1777 ~2^10.80 using namespace std; // 10333 ~2^13.33 using ll = long long; // seq 1 128 | factor 100333 ~2^16.61 using vl = vector<ll>; // | grep -v ' .* ' 1300111 ~2^20.31 using vvl = vect...
#include <bits/stdc++.h> // [PRIMES] 1777 ~2^10.80 using namespace std; // 10333 ~2^13.33 using ll = long long; // seq 1 128 | factor 100333 ~2^16.61 using vl = vector<ll>; // | grep -v ' .* ' 1300111 ~2^20.31 using vvl = vect...
insert
44
44
44
46
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ops cout << "ops" << endl; #define freopens \ freopen("cowpatibility.in", "r", stdin); \ freopen("cowpatibility.out", "w", stdout); #define fast ...
#include <bits/stdc++.h> using namespace std; #define ops cout << "ops" << endl; #define freopens \ freopen("cowpatibility.in", "r", stdin); \ freopen("cowpatibility.out", "w", stdout); #define fast ...
replace
56
57
56
57
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define X first #define Y second typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; #define debug(x) cerr << #x << " = " << (x) << endl; template <typename T> ostream &operator<<(ostream &o, vector<T> &v) { for (auto &x : v...
#include <bits/stdc++.h> using namespace std; #define X first #define Y second typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; #define debug(x) cerr << #x << " = " << (x) << endl; template <typename T> ostream &operator<<(ostream &o, vector<T> &v) { for (auto &x : v...
replace
28
29
28
29
-11
p03170
C++
Runtime Error
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; int n, k; int v[102]; int dp[100002]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; for (int i = 1; i <= n; ++i) cin >> v[i]; // 2 = losing state, 1 = winning state for (int i = 0; i < k; ++i) { i...
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; int n, k; int v[102]; int dp[100002]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; for (int i = 1; i <= n; ++i) cin >> v[i]; // 2 = losing state, 1 = winning state for (int i = 0; i < k; ++i) { i...
replace
17
18
17
18
0
p03170
C++
Runtime Error
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; 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(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0; i...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; 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(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0; i...
replace
25
26
25
26
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> v(n), dp(k + 1); for (int i = 0; i < n; i++) cin >> v[i]; for (int i = 0; i <= k; i++) { if (!dp[i]) for (auto x : v) dp[i + x] = 1; } cout << (dp[k] ? "First" : "Second"); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> v(n), dp(k + 1); for (int i = 0; i < n; i++) cin >> v[i]; for (int i = 0; i <= k; i++) { if (!dp[i]) for (auto x : v) if (i + x <= k) dp[i + x] = 1; } cout << (dp[k] ? "First" :...
replace
12
13
12
14
0
p03170
C++
Runtime Error
// _____ _______ _____ _____ // /\ \ /::\ \ /\ \ /\ \ // /::\ \ /::::\ \ /::\____\ /::\ \ // /::::\ \ /::::::\ \ /:::/ / /::::\ \ // /:...
// _____ _______ _____ _____ // /\ \ /::\ \ /\ \ /\ \ // /::\ \ /::::\ \ /::\____\ /::\ \ // /::::\ \ /::::::\ \ /:::/ / /::::\ \ // /:...
replace
57
58
57
58
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (int)(n); ++(i)) #define REPN(i, m, n) for (int(i) = m; (i) < (int)(n); ++(i)) #define REP_REV(i, n) for (int(i) = (int)(n)-1; (i) >= 0; --(i)) #define REPN_REV(i, m, n) for (int(i) = (int)(n)-1; (i) >= m; --(i)) #define INF 2e9 #d...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (int)(n); ++(i)) #define REPN(i, m, n) for (int(i) = m; (i) < (int)(n); ++(i)) #define REP_REV(i, n) for (int(i) = (int)(n)-1; (i) >= 0; --(i)) #define REPN_REV(i, m, n) for (int(i) = (int)(n)-1; (i) >= m; --(i)) #define INF 2e9 #d...
replace
38
39
38
39
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int dp[100006]; int arr[106]; int n; int fun(int k) { if (k == 0) return 0; if (dp[k] != -1) return dp[k]; int ans = 0; for (int i = 0; i < n; i++) { if (arr[i] <= k) ans |= (!fun(k - arr[i])); } // cout<<k<<" "<<ans<<endl; return dp[n] ...
#include <bits/stdc++.h> using namespace std; int dp[100006]; int arr[106]; int n; int fun(int k) { if (k == 0) return 0; if (dp[k] != -1) return dp[k]; int ans = 0; for (int i = 0; i < n; i++) { if (arr[i] <= k) ans |= (!fun(k - arr[i])); } // cout<<k<<" "<<ans<<endl; return dp[k] ...
replace
21
22
21
22
TLE
p03170
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _; int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1}; int dy[] = {0, 1, 0, -1, -1, 1, 1, -1}; int main() { int n, k; cin >> n >> k; vector<int> a(n); fo...
#include <iostream> #include <vector> using namespace std; struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _; int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1}; int dy[] = {0, 1, 0, -1, -1, 1, 1, -1}; int main() { int n, k; cin >> n >> k; vector<int> a(n); fo...
replace
25
26
25
26
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define ull unsigned long long int #define mod 1000000007 using namespace std; int main(int argc, char const *argv[]) { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(N...
#include <bits/stdc++.h> #define ll long long int #define ull unsigned long long int #define mod 1000000007 using namespace std; int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); ll t = 1; // cin>>t; while (t--) { int n, k; cin >> n >> k; ll arr[n]; fo...
replace
7
11
7
8
-11
p03170
C++
Runtime Error
#include <iomanip> #include <iostream> #include <map> #include <vector> using namespace std; #define MOD 1000000007 int N, K; int a[100]; int dp[100001]; int dfs(int x) { if (dp[x] != -1) return dp[x]; for (int i = 0; i < N; i++) { dp[x - a[i]] = dfs(x - a[i]); if (dp[x - a[i]] == 0) { dp[x] = ...
#include <iomanip> #include <iostream> #include <map> #include <vector> using namespace std; #define MOD 1000000007 int N, K; int a[100]; int dp[100001]; int dfs(int x) { if (dp[x] != -1) return dp[x]; for (int i = 0; i < N; i++) { if (x - a[i] < 0) continue; dp[x - a[i]] = dfs(x - a[i]); i...
insert
16
16
16
18
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef pair<bool, int> pbi; int arr[105]; map<pbi, bool> mp; bool play(bool turn, int n, int k) { if (k == 0) return turn; pbi temp = pbi(turn, k); auto it = mp.begin(); if ((it = mp.find(temp)) != mp.end()) return it->second; bool flag = turn; for (int...
#include <bits/stdc++.h> using namespace std; typedef pair<bool, int> pbi; int arr[105]; struct hasher { size_t operator()(const pbi &temp) const { return hash<bool>()(temp.first) ^ hash<int>()(temp.second); } }; unordered_map<pbi, bool, hasher> mp; bool play(bool turn, int n, int k) { if (k == 0) return ...
replace
4
5
4
10
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define ll long long using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); rep(i, n) { cin >> a[i]; } int dp[101]; memset(dp, 0, sizeof(dp)); dp[0] = -1; for (int i = 1; i <= k; i++) { bool f = true;...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define ll long long using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); rep(i, n) { cin >> a[i]; } int dp[100001]; memset(dp, 0, sizeof(dp)); dp[0] = -1; for (int i = 1; i <= k; i++) { bool f = tr...
replace
13
14
13
14
0
p03170
C++
Runtime Error
#define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/stack:512000000") #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <ccomplex> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #...
#define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/stack:512000000") #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <ccomplex> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #...
insert
93
93
93
95
0
p03170
C++
Runtime Error
#include "bits/stdc++.h" #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL) #define f(i, a, b) for (i = a; i <...
#include "bits/stdc++.h" #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL) #define f(i, a, b) for (i = a; i <...
replace
21
25
21
27
0
p03170
C++
Runtime Error
#include <cstdio> #include <cstring> #define N 110 using namespace std; int n, k; int dp[N][2]; int a[N]; 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; } signed main() { m...
#include <cstdio> #include <cstring> #define N 100010 using namespace std; int n, k; int dp[N][2]; int a[N]; 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; } signed main() { ...
replace
2
3
2
3
0
p03170
C++
Runtime Error
/** e==m*pow(c,2) **/ #include <bits/stdc++.h> using namespace std; #define DEBUG 0 #define LL long long #define int long long // #define OFFLINE 2585 #define pii pair<int, int> #define SQR(n) (n * n) #define pb push_back // #define endl '\n' #define yes cout << "YES" << endl #define no cout << "NO" << endl #define INF...
/** e==m*pow(c,2) **/ #include <bits/stdc++.h> using namespace std; #define DEBUG 0 #define LL long long #define int long long // #define OFFLINE 2585 #define pii pair<int, int> #define SQR(n) (n * n) #define pb push_back // #define endl '\n' #define yes cout << "YES" << endl #define no cout << "NO" << endl #define INF...
replace
50
51
50
52
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define MAX 100005 int who[MAX]; int main() { int n, k, lm = MAX; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] < lm) lm = a[i]; } for (int i = 0; i < lm; i++) who[i] = 2; for (int i = lm; i <= k; i++) ...
#include <bits/stdc++.h> using namespace std; #define MAX 100005 int who[MAX]; int main() { int n, k, lm = MAX; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] < lm) lm = a[i]; } for (int i = 0; i < lm; i++) who[i] = 2; for (int i = lm; i <= k; i++) ...
insert
26
26
26
28
0
p03170
C++
Runtime Error
// ~/SolverToBe/Developers/Corvus // ~/sudo apt-get verdict Accpeted #include <algorithm> #include <assert.h> #include <bitset> #include <cstring> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <memory.h> #include <queue> #include <set> #include <stack> #includ...
// ~/SolverToBe/Developers/Corvus // ~/sudo apt-get verdict Accpeted #include <algorithm> #include <assert.h> #include <bitset> #include <cstring> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <memory.h> #include <queue> #include <set> #include <stack> #includ...
replace
44
45
44
45
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define FASTIO #define endl \ "\n" // Since endl forces a buffer flush which slows down large I/O // operations. #define ff first #define ss second #define pb push_back #define input(c, n) ...
#include <bits/stdc++.h> #define FASTIO #define endl \ "\n" // Since endl forces a buffer flush which slows down large I/O // operations. #define ff first #define ss second #define pb push_back #define input(c, n) ...
replace
65
66
65
71
TLE
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() using namespace std; const int INF = 1145141919, MOD = 1e9 + 7; const long long LINF = 8931145141919364364, LMOD = 998244353; inline long long mod(long long n, long long m) { return (n % m + m) % m; } // const i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() using namespace std; const int INF = 1145141919, MOD = 1e9 + 7; const long long LINF = 8931145141919364364, LMOD = 998244353; inline long long mod(long long n, long long m) { return (n % m + m) % m; } // const i...
replace
27
32
27
29
TLE
p03170
C++
Runtime Error
/* ___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat. ___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat. ___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb. ___az dast o zabane ke barayad ? ___kaz ohdeye shokrash be dar ayad...
/* ___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat. ___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat. ___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb. ___az dast o zabane ke barayad ? ___kaz ohdeye shokrash be dar ayad...
insert
87
87
87
89
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define int long long int #define mod 1000000007 #define inf 1e18 #define fo(i, y, n, inc) for (int i = y; i < n + y; i += inc) #define cin(t) \ int t; \ cin...
#include <bits/stdc++.h> #define int long long int #define mod 1000000007 #define inf 1e18 #define fo(i, y, n, inc) for (int i = y; i < n + y; i += inc) #define cin(t) \ int t; \ cin...
delete
77
78
77
77
0
p03170
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; int f[101], a[101]; int n, m; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { if (a[j] <= i && !f[i - a[j]]) { f[i] = 1; break; } els...
#include "bits/stdc++.h" using namespace std; int f[100001], a[101]; int n, m; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { if (a[j] <= i && !f[i - a[j]]) { f[i] = 1; break; } ...
replace
2
3
2
3
0
p03170
C++
Runtime Error
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdi...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdi...
replace
1,013
1,016
1,013
1,016
-11
p03170
C++
Runtime Error
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace st...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace st...
replace
68
69
68
69
0
p03170
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int stones(vector<int> &v, int k) { int dp[k + 1]; memset(dp, 0, sizeof(dp)); for (int i = 1; i <= k; i++) { for (int x : v) { if (i < x) continue; if (dp[i - x] == 0) dp[i] = 1; // if taro starts with k ans removing some value ...
#include <bits/stdc++.h> using namespace std; int stones(vector<int> &v, int k) { int dp[k + 1]; memset(dp, 0, sizeof(dp)); for (int i = 1; i <= k; i++) { for (int x : v) { if (i < x) continue; if (dp[i - x] == 0) dp[i] = 1; // if taro starts with k ans removing some value ...
replace
36
40
36
40
TLE
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e2 + 9; const int K = 1e5 + 9; int n, k; int a[N]; bool dp[K]; // 石の個数が k 個なら first は必ず負ける int main() { cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; fill(&dp[0], &dp[K], true); for (int s = 0; s <= k; s++) { for (int i = 1; i <=...
#include <bits/stdc++.h> using namespace std; const int N = 1e2 + 9; const int K = 1e6; int n, k; int a[N]; bool dp[K]; // 石の個数が k 個なら first は必ず負ける int main() { cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; fill(&dp[0], &dp[K], true); for (int s = 0; s <= k; s++) { for (int i = 1; i <= n; ...
replace
3
4
3
4
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vb = vector<bool>; using vl = vector<long>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvb = vector<vector<bool>>; using vvc = vector<vector<char>>; using vvl = vector<vector<long>>; using pii = pair<int, int>; using pil ...
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vb = vector<bool>; using vl = vector<long>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvb = vector<vector<bool>>; using vvc = vector<vector<char>>; using vvl = vector<vector<long>>; using pii = pair<int, int>; using pil ...
insert
31
31
31
33
0
p03170
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstring> #include <iostream> #include <math.h> #include <numeric> #include <regex> #include <string> #include <vector> using namespace std; using ll = long long; using dbl = double; using pii = pair<int, int>; using pl4 = pair<ll, ll>; using vi ...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstring> #include <iostream> #include <math.h> #include <numeric> #include <regex> #include <string> #include <vector> using namespace std; using ll = long long; using dbl = double; using pii = pair<int, int>; using pl4 = pair<ll, ll>; using vi ...
replace
391
393
391
395
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define endl '\n' using namespace std; int const MX = 100009; int N, K, a[MX], dp[MX][2]; // dp[k][p] = can player p win with k stones if so 1 else 2 int const lose = 2, win = 1; void read_input() { cin >> N >> K; for (int i = 1; i <= N; ++i) { cin >> a[i]; } } int main() { ios::s...
#include <bits/stdc++.h> #define endl '\n' using namespace std; int const MX = 100009; int N, K, a[MX], dp[MX][2]; // dp[k][p] = can player p win with k stones if so 1 else 2 int const lose = 2, win = 1; void read_input() { cin >> N >> K; for (int i = 1; i <= N; ++i) { cin >> a[i]; } } int main() { ios::s...
replace
29
31
29
32
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define ld long double #define pb push_back #define all(x) x.begin(), x.end() #define ff first #define ss second #define mod 1000000007 using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, k; cin >> n >> k;...
#include <bits/stdc++.h> #define ll long long int #define ld long double #define pb push_back #define all(x) x.begin(), x.end() #define ff first #define ss second #define mod 1000000007 using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, k; cin >> n >> k;...
replace
23
24
23
24
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); ...
replace
29
30
29
30
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; ++i) #define all(v) v.begin(), v.end() using namespace std; using ll = long long; typedef pair<int, int> P; const int INF = 1001001001; const long double PI = (acos(-1)); const int mod = 1e9 + 7; const int vx[4] = {0, 1, 0, -1}; const int vy[4] = {1, 0,...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; ++i) #define all(v) v.begin(), v.end() using namespace std; using ll = long long; typedef pair<int, int> P; const int INF = 1001001001; const long double PI = (acos(-1)); const int mod = 1e9 + 7; const int vx[4] = {0, 1, 0, -1}; const int vy[4] = {1, 0,...
replace
22
23
22
23
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; vector<int> v(n); vector<bool> vu(k + 1); for (int i = 0; i < n; ++i) cin >> v[i]; for (int i = 0; i <= k; ++i) { if (!vu[i]) { for (int k : v) vu[i + k] = true...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; vector<int> v(n); vector<bool> vu(2 * k + 1); for (int i = 0; i < n; ++i) cin >> v[i]; for (int i = 0; i <= k; ++i) { if (!vu[i]) { for (int k : v) vu[i + k] = ...
replace
9
10
9
10
0
p03170
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; bool recursive(int N, int K, vector<int> &a, bool turn, vector<vector<int>> &table) { if (table[K][turn] != -1) return table[K][turn]; if (K < a[0]) { table[K][turn] = !turn; return !turn; } else { for (int i = 0; i < N; ++...
#include <iostream> #include <vector> using namespace std; bool recursive(int N, int K, vector<int> &a, bool turn, vector<vector<int>> &table) { if (table[K][turn] != -1) return table[K][turn]; if (K < a[0]) { table[K][turn] = !turn; return !turn; } else { for (int i = 0; i < N; ++...
insert
13
13
13
15
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; bool dp[100011]; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } for (int i = 0; i < k; ++i) { for (int j = 0; j < n; ++j) { if (!dp[i]) dp[i + a[j]] = true; } } if (dp[k]) { ...
#include <bits/stdc++.h> using namespace std; bool dp[200011]; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } for (int i = 0; i < k; ++i) { for (int j = 0; j < n; ++j) { if (!dp[i]) dp[i + a[j]] = true; } } if (dp[k]) { ...
replace
3
4
3
4
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)n; i++) #define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++) #define all(x) x.begin(), x.end() #define MOD 1000000007 // 1e9+7 using namespace std; typedef long long ll; typedef vector<bool> vecbool; typedef vector<int> vecint; t...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)n; i++) #define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++) #define all(x) x.begin(), x.end() #define MOD 1000000007 // 1e9+7 using namespace std; typedef long long ll; typedef vector<bool> vecbool; typedef vector<int> vecint; t...
replace
31
32
31
32
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ff first #define ss second #define eb emplace_back #define MP make_pair #define pb push...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ff first #define ss second #define eb emplace_back #define MP make_pair #define pb push...
replace
69
73
69
73
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> // #include <algorithm> // #include <iomanip> #define ll long long #define map unordered_map #define set unordered_set using namespace std; const ll MOD = 1000000007; const ll INF = (1LL << 62); ll dp[110000]; int main() { // std::cout << std::fixed << std::setprecis...
#include <bits/stdc++.h> #include <iostream> // #include <algorithm> // #include <iomanip> #define ll long long #define map unordered_map #define set unordered_set using namespace std; const ll MOD = 1000000007; const ll INF = (1LL << 62); ll dp[110000]; int main() { // std::cout << std::fixed << std::setprecis...
replace
31
32
31
34
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, arr[101], k; bool dp[100001]; int main() { ios_base::sync_with_stdio(0); cin.tie(); cout.tie(); cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> arr[i]; } for (int i = 1; i <= k; i++) { for (int j = 1; j <= n; j++) { if (!dp[i - arr[j...
#include <bits/stdc++.h> using namespace std; int n, arr[101], k; bool dp[100001]; int main() { ios_base::sync_with_stdio(0); cin.tie(); cout.tie(); cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> arr[i]; } for (int i = 1; i <= k; i++) { for (int j = 1; j <= n; j++) { if (arr[j] > i) {...
insert
15
15
15
18
0
p03170
C++
Runtime Error
/* * author: chw0501 * created: 15.04.2020 07:37:31(UTC) */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; int n, k; vector<int> v; // dp[i]: i개의 돌이 남았을 때 플레이 할 때 이번 플레이어가 이기면 1, 지면 0을 // 저장 int dp[100001]; int solve(int i) { int &ret = dp[i]; if (ret != -1) ...
/* * author: chw0501 * created: 15.04.2020 07:37:31(UTC) */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; int n, k; vector<int> v; // dp[i]: i개의 돌이 남았을 때 플레이 할 때 이번 플레이어가 이기면 1, 지면 0을 // 저장 int dp[100001]; int solve(int i) { int &ret = dp[i]; if (ret != -1) ...
insert
24
24
24
26
0
p03170
C++
Runtime Error
/** Which of the favors of your Lord will you deny ? **/ #include <bits/stdc++.h> using namespace std; #define LL long long #define PII pair<int, int> #define PLL pair<LL, LL> #define MP make_pair #define F first #define S second #define ALL(x) (x).begin(), (x).end() #define DBG(x) cerr << __LINE__ << " says: " << ...
/** Which of the favors of your Lord will you deny ? **/ #include <bits/stdc++.h> using namespace std; #define LL long long #define PII pair<int, int> #define PLL pair<LL, LL> #define MP make_pair #define F first #define S second #define ALL(x) (x).begin(), (x).end() #define DBG(x) cerr << __LINE__ << " says: " << ...
replace
82
84
82
84
0
p03170
C++
Runtime Error
#pragma GCC optimize("03") #include <bits/stdc++.h> using namespace std; int n, k, a[105], dp[100005]; int main() { cin.tie(NULL); ios_base::sync_with_stdio(false); cin >> n >> k; for (int i = 1; i <= n; ++i) cin >> a[i]; for (int i = 0; i <= k; ++i) { if (dp[i] == 0) for (int j = 1; j <= n...
#pragma GCC optimize("03") #include <bits/stdc++.h> using namespace std; int n, k, a[100005], dp[200005]; int main() { cin.tie(NULL); ios_base::sync_with_stdio(false); cin >> n >> k; for (int i = 1; i <= n; ++i) cin >> a[i]; for (int i = 0; i <= k; ++i) { if (dp[i] == 0) for (int j = 1; j <...
replace
5
6
5
6
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int &x : a) { cin >> x; } vector<bool> dp(k + 1); dp[0] = false; for (int i = 0; i <= k; i++) { for (int j = 0; j < n; j++) { if (dp[i] == false) { dp[i + a[j]] = true; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int &x : a) { cin >> x; } vector<bool> dp(k + 1); dp[0] = false; for (int i = 0; i <= k; i++) { for (int j = 0; j < n; j++) { if (dp[i] == false && i + a[j] <= k) { dp[i + a...
replace
15
16
15
16
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, k, a[101]; bool dp[100001]; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; dp[0] = false; for (int i = 1; i <= k; i++) { for (int j = 1; j <= n; j++) { if (dp[i - a[j]] == false && i >= a[j]) { dp[i] = true; ...
#include <bits/stdc++.h> using namespace std; int n, k, a[101]; bool dp[100001]; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; dp[0] = false; for (int i = 1; i <= k; i++) { for (int j = 1; j <= n; j++) { if (i >= a[j] && dp[i - a[j]] == false) { dp[i] = true; ...
replace
11
12
11
12
0
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; bool dp[100100]; int main() { ll n, k; cin >> n >> k; vector<ll> a(n); rep(i, n) cin >> a[i]; rep(i, k) rep(j, n) if (!dp[i]) dp[i + a[j]] = true; cout << (dp[k] ? "First" : "Second") << ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; bool dp[200100]; int main() { ll n, k; cin >> n >> k; vector<ll> a(n); rep(i, n) cin >> a[i]; rep(i, k) rep(j, n) if (!dp[i]) dp[i + a[j]] = true; cout << (dp[k] ? "First" : "Second") << ...
replace
6
7
6
7
0
p03170
C++
Runtime Error
#include <iostream> #define MAXK 100100 using namespace std; int dp[MAXK]; int A[110]; int main() { int n, k; cin >> n >> k; for (int i = 0; i <= k; i++) dp[i] = -1; for (int i = 0; i < n; i++) cin >> A[i]; dp[0] = 1; for (int i = 0; i < n; i++) { dp[A[i]] = 0; } for (int i = 1; i <= k...
#include <iostream> #define MAXK 100100 using namespace std; int dp[MAXK]; int A[110]; int main() { int n, k; cin >> n >> k; for (int i = 0; i <= k; i++) dp[i] = -1; for (int i = 0; i < n; i++) cin >> A[i]; dp[0] = 1; for (int i = 0; i < n; i++) { dp[A[i]] = 0; } for (int i = 1; i <= k...
replace
26
27
26
29
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 std; typedef long long ll; using namespace __gnu_pbds; #define ordered_set \ tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistic...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; typedef long long ll; using namespace __gnu_pbds; #define ordered_set \ tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistic...
replace
54
57
54
58
TLE
p03170
C++
Runtime Error
#pragma gcc optimize("Ofast") #include <bits/stdc++.h> using namespace std; int n, k; int dp[100005]; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = a[0]; i <= k; i++) { for (int j = 0; a[j] <= i; j++) { ...
#pragma gcc optimize("Ofast") #include <bits/stdc++.h> using namespace std; int n, k; int dp[100005]; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = a[0]; i <= k; i++) { for (int j = 0; a[j] <= i && j < n;...
replace
14
15
14
15
0
p03170
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; template <typename F, typename S> ostream &operator<<(ostream &os, const pair<F, S> &p) { return os << "(" << p.first << ", " << p.second << ")"; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << "{"; typename vector<T>::const_iter...
#include <bits/stdc++.h> using namespace std; template <typename F, typename S> ostream &operator<<(ostream &os, const pair<F, S> &p) { return os << "(" << p.first << ", " << p.second << ")"; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << "{"; typename vector<T>::const_iter...
replace
102
103
102
103
0