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
p03166
C++
Time Limit Exceeded
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; int const MAXN = 100100; int n, m, dp[MAXN]; vector<int> g[MAXN]; int dfs(int node) { if (dp[node] != -1) return dp[node]; int best = 0; for (int x : g[node]) best = max(best, 1 + dfs(x)); return best; } int main() { cin >> n >> ...
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; int const MAXN = 100100; int n, m, dp[MAXN]; vector<int> g[MAXN]; int dfs(int node) { if (dp[node] != -1) return dp[node]; int best = 0; for (int x : g[node]) best = max(best, 1 + dfs(x)); return dp[node] = best; } int main() { c...
replace
12
13
12
13
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ALL(a) (a).begin(), (a).end() #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<long long, long long> Pll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<long long> vll; typedef...
#include <bits/stdc++.h> #define ALL(a) (a).begin(), (a).end() #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<long long, long long> Pll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<long long> vll; typedef...
replace
38
39
38
39
TLE
p03166
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int maxn = 3e3 + 5; int n, m; vector<int> a[maxn]; int f[maxn]; int dp(int u) { if (f[u] != -1) return f[u]; f[u] = 0; for (int v : a[u]) f[u] = max(f[u], dp(v) + 1); return f[u]; } int main() { #ifdef NTMA freopen("abc.inp", "r", stdin); #endif ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n, m; vector<int> a[maxn]; int f[maxn]; int dp(int u) { if (f[u] != -1) return f[u]; f[u] = 0; for (int v : a[u]) f[u] = max(f[u], dp(v) + 1); return f[u]; } int main() { #ifdef NTMA freopen("abc.inp", "r", stdin); #endif ...
replace
3
4
3
4
0
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 112345; int n, m; vector<int> adj[MAXN]; int pd[MAXN]; int rec(int cur) { if (pd[cur] != -1) return pd[cur]; int rtn = 0; for (int i = 0; i < adj[cur].size(); i++) { rtn = max(1 + rec(adj[cur][i]), rtn); } ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 112345; int n, m; vector<int> adj[MAXN]; int pd[MAXN]; int rec(int cur) { if (pd[cur] != -1) return pd[cur]; int rtn = 0; for (int i = 0; i < adj[cur].size(); i++) { rtn = max(1 + rec(adj[cur][i]), rtn); } ...
replace
19
20
19
20
TLE
p03166
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define hash sodnf9843bsd #define ll long long #define INF (1 << 29) #define INFF 0x7fffffff #define LINF (1ll << 60) #define LINFF 0x7fffffffffffffff #define PI 3.14159265359 #define _fi(n) for (int i ...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define hash sodnf9843bsd #define ll long long #define INF (1 << 29) #define INFF 0x7fffffff #define LINF (1ll << 60) #define LINFF 0x7fffffffffffffff #define PI 3.14159265359 #define _fi(n) for (int i ...
replace
28
29
28
29
0
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; vector<int> A[100001]; int dp[100001]; bool visit[100001]; int dfs(int x) { int mx = 0; visit[x] = false; if (A[x].size() == 0) { dp[x] = 0; return 0; } for (int i = 0; i < A[x].size(); i++) if (visit[A[x][i]] == false) mx = max(mx, dfs(A[x][i]))...
#include <bits/stdc++.h> using namespace std; vector<int> A[100001]; int dp[100001]; bool visit[100001]; int dfs(int x) { int mx = 0; visit[x] = true; if (A[x].size() == 0) { dp[x] = 0; return 0; } for (int i = 0; i < A[x].size(); i++) if (visit[A[x][i]] == false) mx = max(mx, dfs(A[x][i]));...
replace
7
8
7
8
TLE
p03166
C++
Runtime Error
#include <bits/stdc++.h> #include <stdint.h> using namespace std; #define int long long #define pb push_back #define mod 1000000007 #define endl '\n' #define w(x) \ int x; \ cin >...
#include <bits/stdc++.h> #include <stdint.h> using namespace std; #define int long long #define pb push_back #define mod 1000000007 #define endl '\n' #define w(x) \ int x; \ cin >...
replace
53
55
53
55
0
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int child[100001]; int marker[100001]; int maximumm = 0; int dfs(int head, vector<int> v[]) { child[head] = 1; int maxi = 0; for (int i = 0; i < v[head].size(); i++) { // maxi=0; if (marker[v[head][i]] == 0) { int x = dfs(v[head][i], v); if (x > ma...
#include <bits/stdc++.h> using namespace std; int child[100001]; int marker[100001]; int maximumm = 0; int dfs(int head, vector<int> v[]) { child[head] = 1; int maxi = 0; for (int i = 0; i < v[head].size(); i++) { // maxi=0; if (marker[v[head][i]] == 0) { marker[v[head][i]] = 1; int x = dfs(v[...
insert
11
11
11
12
TLE
p03166
C++
Time Limit Exceeded
/*author:anshumanc007 created on:08/01/2019 */ // EMBRACE THE STRUGGLE!!! #include <bits/stdc++.h> #include <queue> #include <stack> using namespace std; // typedef pair<long long int,long long int> pa; #define MAX 100005 long long int MOD = 1e9 + 7; long long int INF = 1e18; stack<long long int> st; bo...
/*author:anshumanc007 created on:08/01/2019 */ // EMBRACE THE STRUGGLE!!! #include <bits/stdc++.h> #include <queue> #include <stack> using namespace std; // typedef pair<long long int,long long int> pa; #define MAX 100005 long long int MOD = 1e9 + 7; long long int INF = 1e18; stack<long long int> st; bo...
replace
20
21
20
22
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define endl "\n" #define all(x) (x).begin(), (x).end() #define PI 3.1415926535897932384626433832795 int MOD = 1e9 + 7; int powmod(int a, int l, int md) { int res = 1; while (l) { if (l & 1) res = res * ...
#include <bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define endl "\n" #define all(x) (x).begin(), (x).end() #define PI 3.1415926535897932384626433832795 int MOD = 1e9 + 7; int powmod(int a, int l, int md) { int res = 1; while (l) { if (l & 1) res = res * ...
replace
47
48
47
48
TLE
p03166
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e5; const int INF = 1e9 + 5; int dp[N]; bool vis[N]; vector<int> adj[N]; int mx = 0; int calc(int x) { if (x < 1) return -1 * INF; if (vis[x]) return dp[x]; vis[x] = 1; int mx_dist = 0; if (adj[x].size()) for (auto i : adj[x]) { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const int INF = 1e9 + 5; int dp[N]; bool vis[N]; vector<int> adj[N]; int mx = 0; int calc(int x) { if (x < 1) return -1 * INF; if (vis[x]) return dp[x]; vis[x] = 1; int mx_dist = 0; if (adj[x].size()) for (auto i : adj[x])...
replace
4
5
4
5
0
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long int #define mod 1000000007 using namespace std; int dfs(vector<int> g[], int dp[], int x) { int temp = 0; for (auto it : g[x]) { temp = max(temp, dfs(g, dp, it) + 1); } dp[x] = temp; return temp; } int longest_path(vector<int> g[], int n) { int dp[n]; ...
#include <bits/stdc++.h> #define ll long long int #define mod 1000000007 using namespace std; int dfs(vector<int> g[], int dp[], int x) { if (dp[x] != -1) { return dp[x]; } int temp = 0; for (auto it : g[x]) { temp = max(temp, dfs(g, dp, it) + 1); } dp[x] = temp; return temp; } int longest_p...
insert
7
7
7
12
TLE
p03166
C++
Runtime Error
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define INF 2e9 #define ...
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define INF 2e9 #define ...
replace
36
37
36
37
0
p03166
C++
Time Limit Exceeded
// **** WHEN THE GOING GETS TOUGH, THE TOUGH GETS GOING. **** #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 ll long long int #define ull unsigned long long int #define ld long double #define ordered_set ...
// **** WHEN THE GOING GETS TOUGH, THE TOUGH GETS GOING. **** #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 ll long long int #define ull unsigned long long int #define ld long double #define ordered_set ...
insert
77
77
77
78
TLE
p03166
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; i++) template <typename T1, typename T2> inline void chmin(T...
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <set> #include <stack> #include <string> #include <vector> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; i++) template <typename T1, typename T2> inline void chmin(T...
replace
23
24
23
24
-11
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using vc = vector<char>; using vvc = vector<vc>; using pll = pair<ll, ll>; using vpll = vector<pll>; const ll INF = 1LL << 60; const ll MOD = 1e9 + 7; #define rep(i, n) for (ll i = 0; i < (n); i++) temp...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using vc = vector<char>; using vvc = vector<vc>; using pll = pair<ll, ll>; using vpll = vector<pll>; const ll INF = 1LL << 60; const ll MOD = 1e9 + 7; #define rep(i, n) for (ll i = 0; i < (n); i++) temp...
insert
39
39
39
40
TLE
p03166
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define mod 1000000007 #define check exit(0) #define nl cout << endl; #define inp 10 #define ordered_set \ tree<int, null_type, less_equal<int>, rb_tree_ta...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define mod 1000000007 #define check exit(0) #define nl cout << endl; #define inp 200005 #define ordered_set \ tree<int, null_type, less_equal<int>, rb_tre...
replace
7
8
7
8
0
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long int using namespace std; vector<int> a[100005]; int dp[100005], n, m; int dfs(int i) { if (dp[i] != -1) return dp[i]; int ans = 0; for (int x : a[i]) ans = max(ans, dfs(x) + 1); return ans; } int main() { memset(dp, -1, sizeof(dp)); cin >> n >> m; whil...
#include <bits/stdc++.h> #define ll long long int using namespace std; vector<int> a[100005]; int dp[100005], n, m; int dfs(int i) { if (dp[i] != -1) return dp[i]; int ans = 0; for (int x : a[i]) ans = max(ans, dfs(x) + 1); return dp[i] = ans; } int main() { memset(dp, -1, sizeof(dp)); cin >> n >> m...
replace
11
12
11
12
TLE
p03166
C++
Time Limit Exceeded
#include <iostream> #include <vector> typedef long long ll; typedef unsigned long long ull; constexpr size_t MAXN = 1e5; constexpr size_t MAXM = 1e5; constexpr int MOD = 1e9 + 7; std::vector<std::vector<int>> graph; std::vector<int> dp; std::vector<bool> traversed; void traverse(int to) { for (int from : graph[to...
#include <iostream> #include <vector> typedef long long ll; typedef unsigned long long ull; constexpr size_t MAXN = 1e5; constexpr size_t MAXM = 1e5; constexpr int MOD = 1e9 + 7; std::vector<std::vector<int>> graph; std::vector<int> dp; std::vector<bool> traversed; void traverse(int to) { for (int from : graph[to...
insert
18
18
18
19
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; // #define int ll using PII = pair<ll, ll>; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } template ...
#include <bits/stdc++.h> using namespace std; using ll = long long; // #define int ll using PII = pair<ll, ll>; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } template ...
replace
78
79
78
79
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define SORT(c) sort((c).begin(), (c).end()) #define REVETSE(c) reverse((c).begin(), (c).end()) #define SUM(c) accumulate((c).begin(), (c).end(), 0) #define ALL(a) (a).begin(), (a).end() // int gc...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define SORT(c) sort((c).begin(), (c).end()) #define REVETSE(c) reverse((c).begin(), (c).end()) #define SUM(c) accumulate((c).begin(), (c).end(), 0) #define ALL(a) (a).begin(), (a).end() // int gc...
replace
103
105
103
108
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef unsigned long long int ulli; #define vec(s) vector<s>; #define vvec(s) vector<vector<s>>; typedef vector<lli> vi; typedef vector<vi> vvi; typedef pair<lli, lli> pii; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define YN(x) cout ...
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef unsigned long long int ulli; #define vec(s) vector<s>; #define vvec(s) vector<vector<s>>; typedef vector<lli> vi; typedef vector<vi> vvi; typedef pair<lli, lli> pii; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define YN(x) cout ...
replace
21
22
21
22
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define REP(i, m, n) for (int i = (m); i < (n); i++) #define rep(i, n) REP(i, 0, n) typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int inf = 1e9 + 7; vector<vector<int>> G(1000010); int dp[100010]; int dfs(int n) { if (G[n].size()) { ...
#include <bits/stdc++.h> using namespace std; #define REP(i, m, n) for (int i = (m); i < (n); i++) #define rep(i, n) REP(i, 0, n) typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int inf = 1e9 + 7; vector<vector<int>> G(1000010); int dp[100010]; int dfs(int n) { if (G[n].size()) { ...
replace
14
15
14
18
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> typedef long long ll; using namespace std; int dfs(int node, vector<vector<int>> &adj, vector<bool> &vis, vector<int> &dist) { if (!vis[node]) { for (auto &x : adj[node]) { dist[node] = max(dist[node], dfs(x, adj, vis, dist) + 1); } } return dist[node]; } int main(...
#include <bits/stdc++.h> typedef long long ll; using namespace std; int dfs(int node, vector<vector<int>> &adj, vector<bool> &vis, vector<int> &dist) { if (!vis[node]) { vis[node] = 1; for (auto &x : adj[node]) { dist[node] = max(dist[node], dfs(x, adj, vis, dist) + 1); } } return dist[...
insert
7
7
7
8
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int dp[n + 1]; for (int i = 0; i <= n; i++) { dp[i] = 0; } vector<int> v[n + 1]; int indegree[n + 1]; for (int i = 0; i <= n; i++) { indegree[i] = 0; } for (int i = 0; i < m; i++) { int x, y; cin >...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int dp[n + 1]; for (int i = 0; i <= n; i++) { dp[i] = 0; } vector<int> v[n + 1]; int indegree[n + 1]; for (int i = 0; i <= n; i++) { indegree[i] = 0; } for (int i = 0; i < m; i++) { int x, y; cin >...
replace
39
43
39
46
TLE
p03166
C++
Time Limit Exceeded
#include <cstdlib> #include <iostream> #include <vector> void dfs(int i, std::vector<std::vector<int>> graph, std::vector<int> &in, std::vector<long> &dp, std::vector<bool> &visited) { visited[i] = true; for (auto n : graph[i]) { dp[n] = std::max(dp[n], dp[i] + 1); --in[n]; if (in[n] == 0) { ...
#include <cstdlib> #include <iostream> #include <vector> void dfs(int i, std::vector<std::vector<int>> &graph, std::vector<int> &in, std::vector<long> &dp, std::vector<bool> &visited) { visited[i] = true; for (auto n : graph[i]) { dp[n] = std::max(dp[n], dp[i] + 1); --in[n]; if (in[n] == 0) { ...
replace
4
5
4
5
TLE
p03166
C++
Time Limit Exceeded
// KiSmAt #include "bits/stdc++.h" using namespace std; using ll = long long; const ll inf = 1e18; const int N = 2 * 1e5 + 10; ll res; ll a[N], vis[N]; vector<ll> v[N]; ll Dfs(ll node) { for (auto i : v[node]) { if (!vis[i]) Dfs(i); a[node] = max(a[node], 1 + a[...
// KiSmAt #include "bits/stdc++.h" using namespace std; using ll = long long; const ll inf = 1e18; const int N = 2 * 1e5 + 10; ll res; ll a[N], vis[N]; vector<ll> v[N]; ll Dfs(ll node) { vis[node] = 1; for (auto i : v[node]) { if (!vis[i]) Dfs(i); a[node] = ma...
insert
15
15
15
16
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define Art Code #define Artist Shivam Gupta #define MoT This Art belongs to Artist #define FASTIO \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define Art Code #define Artist Shivam Gupta #define MoT This Art belongs to Artist #define FASTIO \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
replace
50
51
50
53
TLE
p03166
C++
Runtime Error
#include <algorithm> #include <cctype> #include <cstdio> #include <cstring> #include <queue> #define qmin(x, y) (x = min(x, y)) #define qmax(x, y) (x = max(x, y)) using namespace std; inline char gc() { // static char buf[100000],*p1,*p2; // return //(p1==p2)&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*...
#include <algorithm> #include <cctype> #include <cstdio> #include <cstring> #include <queue> #define qmin(x, y) (x = min(x, y)) #define qmax(x, y) (x = max(x, y)) using namespace std; inline char gc() { // static char buf[100000],*p1,*p2; // return //(p1==p2)&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*...
replace
42
43
42
43
0
p03166
C++
Runtime Error
#include <iostream> #include <map> #include <vector> using namespace std; map<int, vector<int>> adj; int n, m; bool visited[10005]; int dp[10005]; void dfs(int n) { visited[n] = true; for (auto neigh : adj[n]) { if (!visited[neigh]) dfs(neigh); dp[n] = max(dp[n], 1 + dp[neigh]); } } int solve(int...
#include <iostream> #include <map> #include <vector> using namespace std; map<int, vector<int>> adj; int n, m; bool visited[100005]; int dp[100005]; void dfs(int n) { visited[n] = true; for (auto neigh : adj[n]) { if (!visited[neigh]) dfs(neigh); dp[n] = max(dp[n], 1 + dp[neigh]); } } int solve(i...
replace
7
9
7
9
0
p03166
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int #define pb push_back #define ub upper_bound #define lb lower_bound #define vi vector<int> #define sz(s) (int)s.size() #define pii pair<int, int> #define piii pair<int, pair<int, int>> #define tiii tuple<int, int, int> #define ff first #define ss s...
#include <bits/stdc++.h> using namespace std; #define int long long int #define pb push_back #define ub upper_bound #define lb lower_bound #define vi vector<int> #define sz(s) (int)s.size() #define pii pair<int, int> #define piii pair<int, pair<int, int>> #define tiii tuple<int, int, int> #define ff first #define ss s...
replace
25
26
25
26
0
p03166
C++
Runtime Error
#include <bits/stdc++.h> #include <string.h> #define ll long long #include <vector> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> #include <string.h> #define ll long long #include <vector> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); ...
replace
18
19
18
19
-11
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define FaSt ios::sync_with_stdio(0), cin.tie(0); #define random uniform_int_distribution<long long>(1, 2000000000000000LL)(rng) const int N = 100005; vector<vector<int>> g; int n, m, dp[N], ans; bool solved[N]; int dfs(int u) { if (solved[u]) { return dp[u]; } ...
#include <bits/stdc++.h> using namespace std; #define FaSt ios::sync_with_stdio(0), cin.tie(0); #define random uniform_int_distribution<long long>(1, 2000000000000000LL)(rng) const int N = 100005; vector<vector<int>> g; int n, m, dp[N], ans; bool solved[N]; int dfs(int u) { if (solved[u]) { return dp[u]; } ...
insert
20
20
20
21
TLE
p03166
C++
Time Limit Exceeded
using namespace std; #include <bits/stdc++.h> #define pb push_back #define mk make_pair #define vect vector<ll> #define maap map<ll, ll> #define MOD 1000000007 #define mit map::iterator #define pii pair<ll, ll> #define rep(i, a, b) for (ll i = a; i < b; i++) #define fast ...
using namespace std; #include <bits/stdc++.h> #define pb push_back #define mk make_pair #define vect vector<ll> #define maap map<ll, ll> #define MOD 1000000007 #define mit map::iterator #define pii pair<ll, ll> #define rep(i, a, b) for (ll i = a; i < b; i++) #define fast ...
replace
117
118
117
119
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define mod 1000000007 vector<int> adj[100005]; vector<int> memo(100005, -1); int dfs(int u) { if (memo[u] != -1) return memo[u]; int ans = 0; for (auto it : adj[u]) ans = max(ans, 1 + dfs(it)); return ans; } int...
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define mod 1000000007 vector<int> adj[100005]; vector<int> memo(100005, -1); int dfs(int u) { if (memo[u] != -1) return memo[u]; int ans = 0; for (auto it : adj[u]) ans = max(ans, 1 + dfs(it)); return memo[u] = a...
replace
15
16
15
16
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n, m, dp[100010]; vector<vector<int>> g; int rec(int v) { if (dp[v] != -1) { return dp[v]; } else { int ma = 0; for (auto i : g[v]) { ma = max(ma, rec(i) + 1); } return ma; } } int main() { int ans = 0; cin >> n >> m; g.assign(n, v...
#include <bits/stdc++.h> using namespace std; int n, m, dp[100010]; vector<vector<int>> g; int rec(int v) { if (dp[v] != -1) { return dp[v]; } else { int ma = 0; for (auto i : g[v]) { ma = max(ma, rec(i) + 1); } return dp[v] = ma; } } int main() { int ans = 0; cin >> n >> m; g.ass...
replace
12
13
12
13
TLE
p03166
C++
Time Limit Exceeded
#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
655
656
655
656
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <utility> using namespace std; #define FIN \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(...
#include <bits/stdc++.h> #include <utility> using namespace std; #define FIN \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(...
replace
19
20
19
21
TLE
p03166
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<int> adj[1000]; int dp[100005]; int n, m; int lp(int n) { int &ret = dp[n]; if (ret != -1) return ret; ret = 0; for (int i = 0; i < adj[n].size(); i++) { ret = max(ret, lp(adj[n][i]) + 1); } return ret; } int main() { cin >> n >> m; for (...
#include <bits/stdc++.h> using namespace std; vector<int> adj[100010]; int dp[100005]; int n, m; int lp(int n) { int &ret = dp[n]; if (ret != -1) return ret; ret = 0; for (int i = 0; i < adj[n].size(); i++) { ret = max(ret, lp(adj[n][i]) + 1); } return ret; } int main() { cin >> n >> m; for...
replace
3
4
3
4
0
p03166
C++
Runtime Error
/** * author: Atreus **/ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 3e3 + 10; vector<int> g[maxn], topol; bool visited[maxn]; int dp[maxn]; void dfs(int v) { visited[v] = 1; for (auto u : g[v]) if (!visited[u]) dfs(u); topol.push_back(v); } int main() ...
/** * author: Atreus **/ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 10; vector<int> g[maxn], topol; bool visited[maxn]; int dp[maxn]; void dfs(int v) { visited[v] = 1; for (auto u : g[v]) if (!visited[u]) dfs(u); topol.push_back(v); } int main() ...
replace
8
9
8
9
0
p03166
C++
Runtime Error
#include "algorithm" #include "bitset" #include "climits" #include "cmath" #include "cstdio" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "string" #include "unordered_map" #inclu...
#include "algorithm" #include "bitset" #include "climits" #include "cmath" #include "cstdio" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "string" #include "unordered_map" #inclu...
replace
41
42
41
42
0
p03166
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> g[11000]; ll dp[11000]; ll solve(ll u) { if (dp[u] != -1) return dp[u]; ll ret = 0; for (ll i = 0; i < g[u].size(); i++) { ret = max(ret, solve(g[u][i]) + 1); } return dp[u] = ret; } int main() { ios_base::sync_with_stdi...
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> g[110000]; ll dp[110000]; ll solve(ll u) { if (dp[u] != -1) return dp[u]; ll ret = 0; for (ll i = 0; i < g[u].size(); i++) { ret = max(ret, solve(g[u][i]) + 1); } return dp[u] = ret; } int main() { ios_base::sync_with_st...
replace
3
5
3
5
0
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; #define ll long long int #define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); #define MOD 1000000007 #define pb push_back #define S s...
#include <bits/stdc++.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; #define ll long long int #define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); #define MOD 1000000007 #define pb push_back #define S s...
replace
140
141
140
141
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long #define pb push_back #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define mi map<int, int> #define mii map<pii, int> #define all(a) (a).begin(), (a).end() #define ff first #define ss second #define sz(x) (int)x.size() #define endl '\n' #define h...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define mi map<int, int> #define mii map<pii, int> #define all(a) (a).begin(), (a).end() #define ff first #define ss second #define sz(x) (int)x.size() #define endl '\n' #define h...
replace
31
32
31
32
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <math.h> #include <stdio.h> using namespace std; using vi = vector<int>; using vll = vector<long long int>; using vb = vector<bool>; using vvi = vector<vector<int>>; using vvll = vector<vector<long long int>>; using ll = long long int; ll dp[1000000]; vb ald(1000000, false); ll mem(l...
#include <bits/stdc++.h> #include <math.h> #include <stdio.h> using namespace std; using vi = vector<int>; using vll = vector<long long int>; using vb = vector<bool>; using vvi = vector<vector<int>>; using vvll = vector<vector<long long int>>; using ll = long long int; ll dp[1000000]; vb ald(1000000, false); ll mem(l...
insert
24
24
24
25
TLE
p03166
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef vector<vector<int>> Graph; int dfs(int node, Graph &g, vector<int> &values) { int answer = 0; for (auto i : g[node]) { answer = max(answer, dfs(i, g, values) + 1); } return values[node] = answer; } int main() { int ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef vector<vector<int>> Graph; int dfs(int node, Graph &g, vector<int> &values) { int answer = 0; if (values[node] != -1) return values[node]; for (auto i : g[node]) { answer = max(answer, dfs(i, g, values) + 1); } r...
insert
9
9
9
11
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define N 100010 int vis[N]; int dp[N]; int dfs(int u, vector<vector<int>> &adj) { if (!vis[u]) { for (auto v : adj[u]) dp[u] = max(dp[u], 1 + dfs(v, adj)); } return dp[u]; } int main() { int n, m; cin >> n >> m; vector<vector<int>> adj(n); for (...
#include <bits/stdc++.h> using namespace std; #define N 100010 int vis[N]; int dp[N]; int dfs(int u, vector<vector<int>> &adj) { if (!vis[u]) { vis[u] = 1; for (auto v : adj[u]) dp[u] = max(dp[u], 1 + dfs(v, adj)); } return dp[u]; } int main() { int n, m; cin >> n >> m; vector<vector<int>>...
insert
9
9
9
10
TLE
p03166
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int maxv = 5 + 5; vector<int> arr[maxv]; vector<int> indeg(maxv); vector<int> vis(maxv); vector<int> dis(maxv); void dfs(int i) { vis[i] = 1; for (auto v : arr[i]) { --indeg[v]; dis[v] = max(dis[v], 1 + dis[i]); if (indeg[v...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int maxv = 1e5 + 5; vector<int> arr[maxv]; vector<int> indeg(maxv); vector<int> vis(maxv); vector<int> dis(maxv); void dfs(int i) { vis[i] = 1; for (auto v : arr[i]) { --indeg[v]; dis[v] = max(dis[v], 1 + dis[i]); if (indeg...
replace
4
5
4
5
0
p03166
C++
Runtime Error
/* * Created by Dipta Das on 29-06-2019 * Title: * Problem Link: * Editorial: * Source Code: * Comments: */ #include <bits/stdc++.h> #include <stdio.h> #define fin freopen("input", "r", stdin) #define whatis(x) cerr << #x << ": " << x << endl; using namespace std; using ll = long long; vector<ll> adj[10005]; ...
/* * Created by Dipta Das on 29-06-2019 * Title: * Problem Link: * Editorial: * Source Code: * Comments: */ #include <bits/stdc++.h> #include <stdio.h> #define fin freopen("input", "r", stdin) #define whatis(x) cerr << #x << ": " << x << endl; using namespace std; using ll = long long; vector<ll> adj[100005];...
replace
17
18
17
18
0
p03166
C++
Runtime Error
#include <bits/stdc++.h> #include <fstream> #include <iostream> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define maxim INT_MAX #define fi first #define se second #define INF 1e16 /* 1. If you can't keep solution in mind, then visualize it on a paper. * 2. Try to identify ...
#include <bits/stdc++.h> #include <fstream> #include <iostream> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define maxim INT_MAX #define fi first #define se second #define INF 1e16 /* 1. If you can't keep solution in mind, then visualize it on a paper. * 2. Try to identify ...
replace
26
27
26
27
0
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int dfs(vector<vector<int>> &g, vector<bool> &visited, vector<int> &dp, int u) { visited[u] = true; for (int i = 0; i < g[u].size(); i++) { int v = g[u][i]; dp[u] = max(dp[u], 1 + dfs(g, visited, dp, v)); } return dp[u]; } int main() { int n, m, x, y; ci...
#include <bits/stdc++.h> using namespace std; int dfs(vector<vector<int>> &g, vector<bool> &visited, vector<int> &dp, int u) { if (visited[u]) return dp[u]; visited[u] = true; for (int i = 0; i < g[u].size(); i++) { int v = g[u][i]; dp[u] = max(dp[u], 1 + dfs(g, visited, dp, v)); } return dp[u]; }...
insert
3
3
3
5
TLE
p03166
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; int DFS(vector<vector<int>> Graph, vector<int> DP, int node) { if (DP[node] != 0) { return DP[node]; } int result = 0; unsigned int i; for (i = 0; i < Graph[node].size(); i++) { result = max(result, 1 + DFS(Graph, DP, Gra...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int DFS(vector<vector<int>> &Graph, vector<int> &DP, int node) { if (DP[node] != 0) { return DP[node]; } int result = 0; unsigned int i; for (i = 0; i < Graph[node].size(); i++) { result = max(result, 1 + DFS(Graph, DP, G...
replace
5
6
5
6
TLE
p03166
C++
Runtime Error
#include <bits/stdc++.h> typedef long long lint; using namespace std; const int MAXN = 1e5 + 1; const int INF = 1e9 + 7; vector<int> dp; vector<vector<int>> adj; vector<int> ind; vector<int> outd; int N, M; int f(int s) { int &ret = dp[s]; if (ret != -1) return ret; if (outd[s] == 0) return ret = 0; ret...
#include <bits/stdc++.h> typedef long long lint; using namespace std; const int MAXN = 1e5 + 1; const int INF = 1e9 + 7; vector<int> dp; vector<vector<int>> adj; vector<int> ind; vector<int> outd; int N, M; int f(int s) { int &ret = dp[s]; if (ret != -1) return ret; if (outd[s] == 0) return ret = 0; ret...
replace
27
28
27
28
0
p03166
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define int lon...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define int lon...
replace
33
34
33
34
0
p03166
C++
Time Limit Exceeded
#include <algorithm> #include <deque> #include <iostream> #include <utility> #include <vector> using namespace std; bool check_flg(vector<bool> &flag, vector<pair<vector<int>, vector<int>>> &na, int i) { for (int j = 0; j < na[i].second.size(); j++) { if (flag[na[i].second[j]] == false) ret...
#include <algorithm> #include <deque> #include <iostream> #include <utility> #include <vector> using namespace std; bool check_flg(vector<bool> &flag, vector<pair<vector<int>, vector<int>>> &na, int i) { for (int j = 0; j < na[i].second.size(); j++) { if (flag[na[i].second[j]] == false) ret...
replace
51
52
51
53
TLE
p03166
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; /* typedef */ typedef long long ll; typedef pair<int, int> pii; /* constant */ const ll LINF = 1LL << 50; // const int MAX = 1e+5; const int MAX = 6; const int NIL = -1; /* global variables */ int N, M; vector<vector<int>> G(MAX, vector<int>()); vector<int> indeg(MAX, 0); v...
#include <bits/stdc++.h> using namespace std; /* typedef */ typedef long long ll; typedef pair<int, int> pii; /* constant */ const ll LINF = 1LL << 50; const int MAX = 1e+5; const int NIL = -1; /* global variables */ int N, M; vector<vector<int>> G(MAX, vector<int>()); vector<int> indeg(MAX, 0); vector<int> dist(MAX, N...
replace
7
9
7
8
0
p03166
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <unordered_map> #include <vector> using namespace std; using i64 = int64_t; using P = pair<i64, i64>; // i64 mod...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <unordered_map> #include <vector> using namespace std; using i64 = int64_t; using P = pair<i64, i64>; // i64 mod...
replace
40
41
40
41
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr) #define time__() \ for (long blockTime = NULL; \ (blockTime == NULL ? (blockTime = clock(...
#include <bits/stdc++.h> using namespace std; #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr) #define time__() \ for (long blockTime = NULL; \ (blockTime == NULL ? (blockTime = clock(...
insert
35
35
35
36
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repo(i, n) for (int i = 1; i < (int)(n); i++) #define pb push_back #define mp make_pair #define np next_permutation #define lb lower_bound #define ub upper_bound #define...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repo(i, n) for (int i = 1; i < (int)(n); i++) #define pb push_back #define mp make_pair #define np next_permutation #define lb lower_bound #define ub upper_bound #define...
insert
57
57
57
58
TLE
p03166
C++
Time Limit Exceeded
/* $$$$$$$\ $$\ $$$$$$$\ $$ __$$\ \__| $$ __$$\ $$ | $$ | $$$$$$\ $$$$$$\ $$\ $$$$$$$\ $$ | $$ | $$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$$\ |$$ __$$\ $$ __$$\ $$ |$$ _____|$$$$$$$\ | \____$$\ $$ __$$\ $$ _____...
/* $$$$$$$\ $$\ $$$$$$$\ $$ __$$\ \__| $$ __$$\ $$ | $$ | $$$$$$\ $$$$$$\ $$\ $$$$$$$\ $$ | $$ | $$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$$\ |$$ __$$\ $$ __$$\ $$ |$$ _____|$$$$$$$\ | \____$$\ $$ __$$\ $$ _____...
replace
157
158
157
159
TLE
p03166
C++
Time Limit Exceeded
// clang-format off #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; #ifndef godfather #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,av...
// clang-format off #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; #ifndef godfather #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,av...
insert
92
92
92
94
TLE
p03166
C++
Runtime Error
// #pragma GCC optimize "trapv" // #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define ll long long const int M = 1000000007; #define pb push_back #define fs first #define sc second #define forn(i, k, n) for (int i = k; i < n; ++i) #define nfor(i, n, k) for (int i = n; i >= k; --i) #define vi v...
// #pragma GCC optimize "trapv" // #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define ll long long const int M = 1000000007; #define pb push_back #define fs first #define sc second #define forn(i, k, n) for (int i = k; i < n; ++i) #define nfor(i, n, k) for (int i = n; i >= k; --i) #define vi v...
replace
35
36
35
36
0
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int INF = 1e9; vector<vector<int>> G; ll n, m, ans = 0; ll dp[100100]; ll f(int v) { if (dp[v] != -1) return dp[v]; ll res = 0; for (auto g : G[v]) res = max(res, f(g) + 1); retu...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int INF = 1e9; vector<vector<int>> G; ll n, m, ans = 0; ll dp[100100]; ll f(int v) { if (dp[v] != -1) return dp[v]; ll res = 0; for (auto g : G[v]) res = max(res, f(g) + 1); retu...
replace
18
19
18
19
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define Phuong // <3 typedef pair<int, int> ii; const int inf = 1e9 + 1; int n, m; vector<int> d, deg; vector<vector<int>> g; void DFS(int x) { stack<int> st; st.push(x); while (!st.empty()) { int u = st.top(); st...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define Phuong // <3 typedef pair<int, int> ii; const int inf = 1e9 + 1; int n, m; vector<int> d, deg; vector<vector<int>> g; void DFS(int x) { stack<int> st; st.push(x); while (!st.empty()) { int u = st.top(); st...
replace
19
23
19
27
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <iostream> #include <queue> #include <stack> #include <vector> #define loop(n) for (ll i = 0; i < n; i++) #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); u...
#include <bits/stdc++.h> #include <iostream> #include <queue> #include <stack> #include <vector> #define loop(n) for (ll i = 0; i < n; i++) #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); u...
replace
30
32
30
31
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) #define watch...
#include <bits/stdc++.h> using namespace std; #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) #define watch...
replace
89
90
89
90
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define all(v) v.begin(), v.end() #define mp make_pair #define pb push_back #define f first #define s second vi c[100005]; bool visit[100005]; int ind[100005]; int dp[100005]; void dfs(int x) { vis...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define all(v) v.begin(), v.end() #define mp make_pair #define pb push_back #define f first #define s second vi c[100005]; bool visit[100005]; int ind[100005]; int dp[100005]; void dfs(int x) { vis...
replace
20
24
20
24
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MAX 2000000 #define MOD 1000000007 #define INF 10000000000000000 using Graph = vector<vector<int>>; int dfs(Graph G, int v, vector<int> &length, vector<bool> &seen) { if (seen.at(v)) { return length.at(v); } seen.at(v) = true; int ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MAX 2000000 #define MOD 1000000007 #define INF 10000000000000000 using Graph = vector<vector<int>>; int dfs(Graph &G, int v, vector<int> &length, vector<bool> &seen) { if (seen.at(v)) { return length.at(v); } seen.at(v) = true; int...
replace
8
9
8
9
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> // #include<ext/pb_ds/assoc_container.hpp> // #include<ext/pb_ds/tree_policy.hpp> #define IOS \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> // #include<ext/pb_ds/assoc_container.hpp> // #include<ext/pb_ds/tree_policy.hpp> #define IOS \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
replace
61
63
61
63
TLE
p03166
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...
insert
63
63
63
64
-11
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define N 100009 #define INF 1000000009 #define MOD 1000000007 typedef long long int ll; #define sd(x) scanf("%d", &x) #define sd2(x, y) scanf("%d%d", &x, &y) #define sd3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z) #define pf(x) printf("%d", x); #define pf2(x, y) printf("%d ...
#include <bits/stdc++.h> using namespace std; #define N 100009 #define INF 1000000009 #define MOD 1000000007 typedef long long int ll; #define sd(x) scanf("%d", &x) #define sd2(x, y) scanf("%d%d", &x, &y) #define sd3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z) #define pf(x) printf("%d", x); #define pf2(x, y) printf("%d ...
replace
41
42
41
43
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; vector<int> depth; vector<pair<int, int>> G; int depthG(int n) { if (depth[n] != -1) return depth[n]; auto it = lower_bound(G.begin(), G.end(), make_pair(n, 0)); int ans = 0; while (it != G.end() and *it < make_pair(n + 1, 0)) { ans = max(ans, depthG(it->...
#include <bits/stdc++.h> using namespace std; vector<int> depth; vector<pair<int, int>> G; int depthG(int n) { if (depth[n] != -1) return depth[n]; auto it = lower_bound(G.begin(), G.end(), make_pair(n, 0)); int ans = 0; while (it != G.end() and *it < make_pair(n + 1, 0)) { ans = max(ans, depthG(it->...
replace
16
17
16
17
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; // #include <boost/multiprecision/cpp_ll.hpp> // typedef boost::multiprecision::cpp_ll ll; typedef long double dd; #define i_7 (ll)(1E9 + 7) // #define i_7 998244353 #define i_5 i_7 - 2 ll mod(ll a) { ll c = a % i_7; if (c >= 0) return c; ret...
#include <bits/stdc++.h> using namespace std; typedef long long ll; // #include <boost/multiprecision/cpp_ll.hpp> // typedef boost::multiprecision::cpp_ll ll; typedef long double dd; #define i_7 (ll)(1E9 + 7) // #define i_7 998244353 #define i_5 i_7 - 2 ll mod(ll a) { ll c = a % i_7; if (c >= 0) return c; ret...
replace
54
55
54
55
TLE
p03166
C++
Runtime Error
/*--ILRS-- sr4saurabh */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; #define pb push_back #define popb pop_back #define mp make_pair #define ve vector #define vii vector<int> #define vll vector<ll> #define pii pair<int, int> #define pll pair<ll, ll> #define vpl vector<pll> #define fi first ...
/*--ILRS-- sr4saurabh */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; #define pb push_back #define popb pop_back #define mp make_pair #define ve vector #define vii vector<int> #define vll vector<ll> #define pii pair<int, int> #define pll pair<ll, ll> #define vpl vector<pll> #define fi first ...
replace
55
59
55
59
-11
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define PI acos(-1) using namespace std; using ll = long long; using P = pair<int, int>; using LP = pair<ll, ll>; int dfs(int v, vector<vector<int>> to, vector<int> &dist) { if (dist[v] >= 0) return dist[v]; int res = 0; for (auto e :...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define PI acos(-1) using namespace std; using ll = long long; using P = pair<int, int>; using LP = pair<ll, ll>; int dfs(int v, vector<vector<int>> &to, vector<int> &dist) { if (dist[v] >= 0) return dist[v]; int res = 0; for (auto e ...
replace
9
10
9
10
TLE
p03166
C++
Time Limit Exceeded
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define assert_range(x, a, b) assert((a) <= (x) ...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define assert_range(x, a, b) assert((a) <= (x) ...
insert
25
25
25
26
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> g[323456]; int cnt[323456]; int ans; int d[323456]; vector<int> ord; bool used[323456]; void dfs(int v) { used[v] = true; for (size_t i = 0; i < g[v].size(); ++i) { int to = g[v][i]; if (!used[to]) dfs(to); } ord.push_back(v);...
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> g[323456]; int cnt[323456]; int ans; int d[323456]; vector<int> ord; bool used[323456]; void dfs(int v) { used[v] = true; for (size_t i = 0; i < g[v].size(); ++i) { int to = g[v][i]; if (!used[to]) dfs(to); } ord.push_back(v);...
replace
52
53
52
53
TLE
p03166
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <vector> using namespace std; int vertices, edges; vector<int> grp[10005]; vector<int> dp(10005, -1); vector<int> visited(10005, -1); int findMaxAns(int src) { if (dp[src] != -1) { return dp[src]; } visited[src] = 1; i...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <vector> using namespace std; int vertices, edges; vector<int> grp[100005]; vector<int> dp(100005, -1); vector<int> visited(100005, -1); int findMaxAns(int src) { if (dp[src] != -1) { return dp[src]; } visited[src] = 1; ...
replace
9
12
9
12
0
p03166
C++
Runtime Error
/* Don’t Quit When things go wrong as they sometimes will; When the road you’re trudging seems all uphill; When the funds are low, and the debts are high; And you want to smile, but you have to sigh; ...
/* Don’t Quit When things go wrong as they sometimes will; When the road you’re trudging seems all uphill; When the funds are low, and the debts are high; And you want to smile, but you have to sigh; ...
delete
48
49
48
48
-11
p03166
C++
Runtime Error
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define N_MAX 100000 #define MOD (1000000007) u...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define N_MAX 100000 #define MOD (1000000007) u...
replace
24
25
24
25
0
p03166
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define N 1e6 using namespace std; /******* All Required define Pre-Processors and typedef Constants *******/ #define SCD(t) scanf("%d", &t) #define SCLD(t) scanf("%ld", &t) #define SCLLD(t) scanf("%lld", &t) #define SCC(t) scanf("%c", &t) #define SCS(t) scanf("%s", t...
#include <bits/stdc++.h> #define ll long long int #define N 1e6 using namespace std; /******* All Required define Pre-Processors and typedef Constants *******/ #define SCD(t) scanf("%d", &t) #define SCLD(t) scanf("%ld", &t) #define SCLLD(t) scanf("%lld", &t) #define SCC(t) scanf("%c", &t) #define SCS(t) scanf("%s", t...
delete
65
69
65
65
0
p03166
C++
Runtime Error
// simple dfs not enough coz constraints of order 10^5 are high for normal // recursion #include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); ...
// simple dfs not enough coz constraints of order 10^5 are high for normal // recursion #include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); ...
replace
17
18
17
18
0
p03166
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define ld long double #define endl '\n' #define vll vector<ll> #define vvll vector<vll> #define Cout(x) cout << #x << " " << x << endl #define pll pair<ll, ll> #define vpll vector<pll> #define mp make_pair #define pb push_back #define MOD 1000000007 #define in...
#include <bits/stdc++.h> #define ll long long #define ld long double #define endl '\n' #define vll vector<ll> #define vvll vector<vll> #define Cout(x) cout << #x << " " << x << endl #define pll pair<ll, ll> #define vpll vector<pll> #define mp make_pair #define pb push_back #define MOD 1000000007 #define in...
delete
180
184
180
180
-11
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> adj[100005]; vector<int> toposort; int vis[100005]; void topo(int x) { if (vis[x]) return; for (int i = 0; i < (int)adj[x].size(); i++) { if (vis[adj[x][i]]) continue; topo(adj[x][i]); } toposort.push_back(x); } int main() ...
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> adj[100005]; vector<int> toposort; int vis[100005]; void topo(int x) { if (vis[x]) return; vis[x] = 1; for (int i = 0; i < (int)adj[x].size(); i++) { if (vis[adj[x][i]]) continue; topo(adj[x][i]); } toposort.push_back(x); ...
insert
11
11
11
12
TLE
p03166
C++
Time Limit Exceeded
/* Murad Eynizade */ #include <bits/stdc++.h> #define intt long long #define FAST_READ \ ios_base::sync_with_stdio(0); \ cin.tie(0); #define F first #define S second using namespace std; const int sz = 100...
/* Murad Eynizade */ #include <bits/stdc++.h> #define intt long long #define FAST_READ \ ios_base::sync_with_stdio(0); \ cin.tie(0); #define F first #define S second using namespace std; const int sz = 100...
insert
19
19
19
20
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define int long long using namespace std; vector<vector<int>> g; vector<int> indegree; vector<int> visited; vector<int> depth; void dfs(int v) { visited[v] = 1; for (int u : g[v]) { depth[u] = max(depth[u], depth[v] + 1); dfs(u); } } int32_t main() { ios_base::sync_with_std...
#include <bits/stdc++.h> #define int long long using namespace std; vector<vector<int>> g; vector<int> indegree; vector<int> visited; vector<int> depth; void dfs(int v) { visited[v] = 1; for (int u : g[v]) { depth[u] = max(depth[u], depth[v] + 1); --indegree[u]; if (indegree[u] == 0) dfs(u); ...
replace
14
15
14
17
TLE
p03166
C++
Runtime Error
#include <algorithm> #include <chrono> #include <climits> #include <cmath> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <utility> #include <vector> #defin...
#include <algorithm> #include <chrono> #include <climits> #include <cmath> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <utility> #include <vector> #defin...
replace
44
45
44
45
0
p03166
C++
Runtime Error
#include <algorithm> #include <iostream> #include <stack> #include <vector> using namespace std; typedef long long ll; const int N = 1e5 + 5; vector<vector<int>> g(N); vector<bool> vis(N); vector<int> dp(N); stack<int> topo; void dfs(int u) { vis[u] = 1; for (auto v : g[u]) if (!vis[v]) dfs(v); topo...
#include <algorithm> #include <iostream> #include <stack> #include <vector> using namespace std; typedef long long ll; const int N = 1e5 + 5; vector<vector<int>> g(N); vector<bool> vis(N); vector<int> dp(N); stack<int> topo; void dfs(int u) { vis[u] = 1; for (auto v : g[u]) if (!vis[v]) dfs(v); topo...
replace
46
47
46
47
0
p03166
C++
Runtime Error
#include <bits/stdc++.h> #ifdef ONLINE_JUDGE #define endl "\n" #endif using namespace std; typedef unsigned long long int lu; typedef long long int ll; typedef long double ld; typedef vector<ll> v; typedef vector<lu> vu; typedef vector<v> vv; typedef vector<vu> vvu; typedef vector<ld> vld; typedef vector<bool> vb; type...
#include <bits/stdc++.h> #ifdef ONLINE_JUDGE #define endl "\n" #endif using namespace std; typedef unsigned long long int lu; typedef long long int ll; typedef long double ld; typedef vector<ll> v; typedef vector<lu> vu; typedef vector<v> vv; typedef vector<vu> vvu; typedef vector<ld> vld; typedef vector<bool> vb; type...
replace
90
91
90
91
0
p03166
C++
Runtime Error
#include <bits/stdc++.h> #include <string> using namespace std; #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0)...
#include <bits/stdc++.h> #include <string> using namespace std; #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0)...
replace
502
503
502
503
-11
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; void dfs(int u, vector<int> adj[], vector<int> &dp, vector<bool> vis) { int i, j; vis[u] = true; for (i = 0; i < adj[u].size(); i++) { if (vis[adj[u][i]] == false) dfs(adj[u][i], adj, dp, vis); dp[u] = max(dp[u], 1 + dp[adj[u][i]]); } } int main() { ...
#include <bits/stdc++.h> using namespace std; void dfs(int u, vector<int> adj[], vector<int> &dp, vector<bool> &vis) { int i, j; vis[u] = true; for (i = 0; i < adj[u].size(); i++) { if (vis[adj[u][i]] == false) dfs(adj[u][i], adj, dp, vis); dp[u] = max(dp[u], 1 + dp[adj[u][i]]); } } int main() {...
replace
3
4
3
4
TLE
p03166
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i)) #define all(x) x.begin()...
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i)) #define all(x) x.begin()...
replace
40
41
40
41
0
p03166
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <n...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <n...
replace
33
35
33
34
0
p03166
C++
Time Limit Exceeded
// G - Longest Path #include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vvi = vector<vi>; int in() { int x; scanf("%d", &x); return x; } #define VMAX 100000 vvi V(VMAX); vi D(VMAX, -1); int dfs(int p) { int a = D[p]; if (a > -1) return a; for (int c : V[p]) a = max(a, dfs(c...
// G - Longest Path #include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vvi = vector<vi>; int in() { int x; scanf("%d", &x); return x; } #define VMAX 100000 vvi V(VMAX); vi D(VMAX, -1); int dfs(int p) { int &a = D[p]; if (a > -1) return a; for (int c : V[p]) a = max(a, dfs(...
replace
16
17
16
17
TLE
p03166
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> #define LL long long using namespace std; int n, m, d1, d2, dp[100005], vis[100005]; vector<int> v[100005]; int dfs(int x, int k) { // cout << x << " " << k << "\n"; int MMM = 0; if (dp[x] != 0) return dp[x] + k; if (v[x].empty()) return k; fo...
#include <algorithm> #include <iostream> #include <vector> #define LL long long using namespace std; int n, m, d1, d2, dp[100005], vis[100005]; vector<int> v[100005]; int dfs(int x, int k) { // cout << x << " " << k << "\n"; int MMM = 0; if (dp[x] != 0) return dp[x] + k; if (v[x].empty()) return k; fo...
replace
16
17
16
19
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define pb push_back vector<vector<int>> vec; vector<int> dp; void dfs(int i) { if (vec[i].size() == 0) { dp[i] = 0; } for (auto v : vec[i]) { if (dp[v] = -1) dfs(v); dp[i] = max(dp[v] + 1, dp[i]); } } int main() { int n, m; cin >> n >> m; ...
#include <bits/stdc++.h> using namespace std; #define pb push_back vector<vector<int>> vec; vector<int> dp; void dfs(int i) { if (vec[i].size() == 0) { dp[i] = 0; } for (auto v : vec[i]) { if (dp[v] == -1) dfs(v); dp[i] = max(dp[v] + 1, dp[i]); } } int main() { int n, m; cin >> n >> m; ...
replace
11
12
11
12
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long int #define ar array #define bigint int64_t #define vll vector<ll> #define pll ar<ll, 2> #define vpll vector<pll> #define pb push_back #define MOD 1000000007 #define sz(x) (ll)(x).size() #define ff first #define ss second #define en cout << "\n" #define LCM(a, b) (a * (b / ...
#include <bits/stdc++.h> #define ll long long int #define ar array #define bigint int64_t #define vll vector<ll> #define pll ar<ll, 2> #define vpll vector<pll> #define pb push_back #define MOD 1000000007 #define sz(x) (ll)(x).size() #define ff first #define ss second #define en cout << "\n" #define LCM(a, b) (a * (b / ...
insert
88
88
88
92
TLE
p03166
C++
Runtime Error
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define pb push_back typedef long long ll; const int MAXN = 3e3 + 5; const int MAXW = 1e5 + 5; const int MOD = 1e9 + 7; using namespace std; vector<int> g[MAXN]; int mem[MAXN]; int solve(int u, int c) { if (g[u].empty()) return 0; int &ret = mem[u]; if (...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define pb push_back typedef long long ll; const int MAXN = 1e5 + 5; const int MAXW = 1e5 + 5; const int MOD = 1e9 + 7; using namespace std; vector<int> g[MAXN]; int mem[MAXN]; int solve(int u, int c) { if (g[u].empty()) return 0; int &ret = mem[u]; if (...
replace
4
5
4
5
0
p03166
C++
Time Limit Exceeded
#include <algorithm> #include <assert.h> #include <climits> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x)....
#include <algorithm> #include <assert.h> #include <climits> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x)....
insert
64
64
64
65
TLE
p03166
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <limits.h> using namespace std; typedef long long int ll; typedef long double ld; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> #include <limits.h> using namespace std; typedef long long int ll; typedef long double ld; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
insert
84
84
84
85
TLE