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 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <deque>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#inclu... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <deque>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#inclu... | replace | 82 | 83 | 82 | 84 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pp pair<int, int>
#define rep(i, l, r) for (int i = l; i < r; i++)
vi g[100005];
vi indeg(100005, 0);
vi lp(100005, 0);
int main() {
#ifndef ONLINE_JUD... | #include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pp pair<int, int>
#define rep(i, l, r) for (int i = l; i < r; i++)
vi g[100005];
vi indeg(100005, 0);
vi lp(100005, 0);
int main() {
// #ifndef ONLIN... | replace | 13 | 17 | 13 | 17 | -11 | |
p03166 | C++ | Runtime Error | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
vector<int> g[10005];
int d[100005];
int dfs(int x) {
if (d[x] > 0)
return d[x];
d[x] = 0;
for (int y : g[x]) {
d[x] = max(d[x], dfs(y) + 1);
}
return d[x];
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m... | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
vector<int> g[100005];
int d[100005];
int dfs(int x) {
if (d[x] > 0)
return d[x];
d[x] = 0;
for (int y : g[x]) {
d[x] = max(d[x], dfs(y) + 1);
}
return d[x];
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, ... | replace | 3 | 4 | 3 | 4 | 0 | |
p03166 | 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 ll = long long;
using namespace std;
int N, M;
vector<vector<int>> G;
vector<int> dp;
int f(int now) {
if (dp[now] != 1e9)
return dp[now];
else if (G[now].size() == 0) {
dp[now] = 0;
re... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
int N, M;
vector<vector<int>> G;
vector<int> dp;
int f(int now) {
if (dp[now] != 1e9)
return dp[now];
int mxcount = 0;
for (auto e : G[now])
mxcount =... | replace | 13 | 23 | 13 | 18 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (int i = a; i <= b; i++)
vector<ll> dp;
vector<vector<ll>> s;
bitset<100010> can;
void see(ll her... | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (int i = a; i <= b; i++)
vector<ll> dp;
vector<vector<ll>> s;
bitset<100010> can;
void see(ll her... | replace | 19 | 20 | 19 | 20 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define pb emplace_back
#define endl "\n"
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0)
lli ans... | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define pb emplace_back
#define endl "\n"
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0)
lli ans... | replace | 12 | 13 | 12 | 13 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
void usain_bolt() {
ios::sync_with_stdio(false);
cin.tie(0);
}
const int N = 1e5 + 5;
vector<int> a[N];
queue<int> q;
int in[N], mx, d[N];
void bfs() {
while (!q.empty()) {
int x = q.front();
q.pop();
mx = max(mx, d[x]);
if (in[x] > 0)
cont... | #include <bits/stdc++.h>
using namespace std;
void usain_bolt() {
ios::sync_with_stdio(false);
cin.tie(0);
}
const int N = 1e5 + 5;
vector<int> a[N];
queue<int> q;
int in[N], mx, d[N];
void bfs() {
while (!q.empty()) {
int x = q.front();
q.pop();
mx = max(mx, d[x]);
if (in[x] > 0)
cont... | replace | 24 | 25 | 24 | 25 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define mods 1000000007
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef long long int lint;
typedef unsigned long long int ulint;
list<lint> gelen[100020], giden[100020];
lint dp[100020];
bool hes[100020];
lint hesap(lint a);
lint n, m;
... | #include <bits/stdc++.h>
using namespace std;
#define mods 1000000007
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef long long int lint;
typedef unsigned long long int ulint;
list<lint> gelen[100020], giden[100020];
lint dp[100020];
bool hes[100020];
lint hesap(lint a);
lint n, m;
... | replace | 37 | 38 | 37 | 38 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
const int inf = 2147483647, dx[] = {-1, 0, 1, 0},
dy[] = {0, -1, 0, 1}; // 上 左 下 右
const int ... | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
const int inf = 2147483647, dx[] = {-1, 0, 1, 0},
dy[] = {0, -1, 0, 1}; // 上 左 下 右
const int ... | insert | 29 | 29 | 29 | 30 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <unordered_map>
#include <utility>
#incl... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <unordered_map>
#include <utility>
#incl... | replace | 55 | 56 | 55 | 56 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
typedef long long ll;
const int MAX = 1e5;
vector<int> dp(MAX, -1);
vector<int> g[MAX];
int dfs(int i) {
if (dp[i] != -1)
return dp[i];
int d = 0;
rep(j, g[i].size()) { d = max(d, dfs(g[i][j]) + 1); }
return d... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
typedef long long ll;
const int MAX = 1e5;
vector<int> dp(MAX, -1);
vector<int> g[MAX];
int dfs(int i) {
if (dp[i] != -1)
return dp[i];
int d = 0;
rep(j, g[i].size()) { d = max(d, dfs(g[i][j]) + 1); }
return d... | replace | 14 | 15 | 14 | 15 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
vector<int> dp;
int helperfn(int i, vector<vector<int>> &matrix) {
// cout<<"helperfn"<<" "<<i<<endl;
if (matrix[i].size() == 0)
return 0;
if (dp[i] != -1)
return dp[i];
int maxi = 0;
for (int j = 0; j <= matrix[i].size(); j++) {
maxi = max(maxi, 1 +... | #include <bits/stdc++.h>
using namespace std;
vector<int> dp;
int helperfn(int i, vector<vector<int>> &matrix) {
// cout<<"helperfn"<<" "<<i<<endl;
if (matrix[i].size() == 0)
return 0;
if (dp[i] != -1)
return dp[i];
int maxi = 0;
for (int j = 0; j < matrix[i].size(); j++) {
maxi = max(maxi, 1 + ... | replace | 11 | 12 | 11 | 12 | 0 | |
p03166 | C++ | Runtime Error | // In the Name of ̲A̲l̲l̲a̲h̲
#include <bits/stdc++.h>
using namespace std;
int n, u, v, m;
vector<int> adj[10000];
bool mark[10000];
int mxPath[10000], mxDepth[10000];
void DFS(int v) {
mark[v] = 1;
if (!adj[v].size())
return;
int mx1 = 0;
int mx3 = 0;
int mx2 = 0;
for (int u : adj[v]) {
if (!ma... | // In the Name of ̲A̲l̲l̲a̲h̲
#include <bits/stdc++.h>
using namespace std;
int n, u, v, m;
vector<int> adj[100001];
bool mark[100001];
int mxPath[100001], mxDepth[100001];
void DFS(int v) {
mark[v] = 1;
if (!adj[v].size())
return;
int mx1 = 0;
int mx3 = 0;
int mx2 = 0;
for (int u : adj[v]) {
if ... | replace | 7 | 10 | 7 | 10 | 0 | |
p03166 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <vector>
#define f cin
#define NMAX 200010
using namespace std;
// ifstream f("date.in");
int n, m;
vector<int> a[NMAX];
int interior[NMAX], exterior[NMAX];
int nr, top_sort[NMAX];
int dp[NMAX];
int vis[NMAX];
void dfs(int x) {
f... | #include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <vector>
#define f cin
#define NMAX 200010
using namespace std;
// ifstream f("date.in");
int n, m;
vector<int> a[NMAX];
int interior[NMAX], exterior[NMAX];
int nr, top_sort[NMAX];
int dp[NMAX];
int vis[NMAX];
void dfs(int x) {
v... | insert | 19 | 19 | 19 | 20 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
constexpr int n = 1e5 + 5;
int N, M;
vector<vector<int>> edges(n);
vector<int> dp(n, 0);
vector<int> vis(n, 0);
int dfs(int x) {
if (!x) {
return 0;
}
int ans = 0;
for (int &nb : edges[x]) {
ans = max(dfs(nb) + 1, ans);
}... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
constexpr int n = 1e5 + 5;
int N, M;
vector<vector<int>> edges(n);
vector<int> dp(n, 0);
vector<int> vis(n, 0);
int dfs(int x) {
if (!x) {
return 0;
}
int ans = 0;
for (int &nb : edges[x]) {
if (!vis[nb]) {
ans = max(d... | replace | 15 | 17 | 15 | 20 | TLE | |
p03166 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<int> g[100000];
long long mx[100000];
int n, m;
void dfs(int u) {
if (mx[u] == 0)
for (auto i = g[u].begin(); i != g[u].end(); ++i) {
if (mx[*i] == 0)
dfs(*i);
mx[u] = max(mx[u], mx[*i] + 1);
}
}
int mai... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<int> g[100001];
long long mx[100001];
int n, m;
void dfs(int u) {
if (mx[u] == 0)
for (auto i = g[u].begin(); i != g[u].end(); ++i) {
if (mx[*i] == 0)
dfs(*i);
mx[u] = max(mx[u], mx[*i] + 1);
}
}
int mai... | replace | 4 | 6 | 4 | 6 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int MAX = 1e5;
vector<bool> visited(MAX);
vector<int> dist(MAX);
vector<vector<int>> adj(MAX);
void dfs(int u) {
dist[u] = 0;
for (int it : adj[u]) {
if (!visited[it]) {
dfs(it);
}
dist[u] = max(dist[u], 1 + dist[it]);
... | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int MAX = 1e5;
vector<bool> visited(MAX);
vector<int> dist(MAX);
vector<vector<int>> adj(MAX);
void dfs(int u) {
visited[u] = true;
dist[u] = 0;
for (int it : adj[u]) {
if (!visited[it]) {
dfs(it);
}
dist[u] = max(dist[... | insert | 8 | 8 | 8 | 9 | TLE | |
p03166 | C++ | Runtime Error | // BWOTSHEWCHB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define in insert
#define X first
#define Y second
const int MAXN = 1e4 + 69, MOD = 1e9 + 7;
int n, m, ans, mark[MAXN], dist[MAXN];
vector<int> top, g[MAXN], rev[MAXN];
void dfs(int v) {
mark[v] = 1;
for (auto u : g[v])
if (... | // BWOTSHEWCHB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define in insert
#define X first
#define Y second
const int MAXN = 1e6 + 69, MOD = 1e9 + 7;
int n, m, ans, mark[MAXN], dist[MAXN];
vector<int> top, g[MAXN], rev[MAXN];
void dfs(int v) {
mark[v] = 1;
for (auto u : g[v])
if (... | replace | 11 | 12 | 11 | 12 | 0 | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
#define ll long long
const ll INF = 1LL << ... | #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
#define ll long long
const ll INF = 1LL << ... | replace | 22 | 23 | 22 | 23 | 0 | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define endl '\n'
#define exists(s, e) (s.find(e) != s.end())
#define WHILE(n)
#define pb push_back
#define f first
#define s second
#define UNI(vec) vec.erase(std::unique(vec.begin(), vec.end()), vec.end(... | #include <bits/stdc++.h>
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define endl '\n'
#define exists(s, e) (s.find(e) != s.end())
#define WHILE(n)
#define pb push_back
#define f first
#define s second
#define UNI(vec) vec.erase(std::unique(vec.begin(), vec.end()), vec.end(... | replace | 25 | 26 | 25 | 26 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ii pair<int, int>
#define fi first
#define sc second
using namespace std;
const int N = 1e5 + 5;
int d[N], v[N];
vector<int> adj[N];
int dfs(int i) {
v[i] = 1;
for (int j = 0; j < (int)adj[i].size(); j++) {
d[i] = max(d[i], dfs(adj[i][j]));
}
return d[i] + 1;
}
int main(... | #include <bits/stdc++.h>
#define ii pair<int, int>
#define fi first
#define sc second
using namespace std;
const int N = 1e5 + 5;
int d[N], v[N];
vector<int> adj[N];
int dfs(int i) {
v[i] = 1;
for (int j = 0; j < (int)adj[i].size(); j++) {
int t = adj[i][j];
if (v[t])
t = d[t] + 1;
else
t... | replace | 14 | 15 | 14 | 20 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
r... | #include <bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
r... | replace | 20 | 23 | 20 | 23 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
vector<int> e[100000];
int num[100000];
void dfs(int v) {
int ma = -1;
for (int u : e[v]) {
dfs(u);
ma = max(ma, num[u]);
}
num[v] = ma + 1;
}
int main() {
int n, m;
cin >> n >> m;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
vector<int> e[100000];
int num[100000];
void dfs(int v) {
int ma = -1;
for (int u : e[v]) {
if (num[u] == -1)
dfs(u);
ma = max(ma, num[u]);
}
num[v] = ma + 1;
}
int main() {
int n... | replace | 12 | 13 | 12 | 14 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define vi vector<ll>
#define vb vector<bool>
#define pii pair<ll, ll>
#define mod 1000000007
#define pll pair<ll, ll>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define per(i, n) for (ll i = n - 1; i >= 0; i--)
#define rep1(i, n) fo... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define vi vector<ll>
#define vb vector<bool>
#define pii pair<ll, ll>
#define mod 1000000007
#define pll pair<ll, ll>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define per(i, n) for (ll i = n - 1; i >= 0; i--)
#define rep1(i, n) fo... | replace | 44 | 45 | 44 | 45 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define INF 100000000
#define fi first
#define se second
const int LEN = 2e5 + 5;
const int LEN5 = 1e5 + 5;
const int MOD = 1e9 + 7;
typedef long long ll;
int n, m;
int dp[LEN5];
vector<int> adj[LEN5];
void sol(int x) {
dp[x] = 0;
for (auto v : adj[x]) {
sol(v);
... | #include <bits/stdc++.h>
using namespace std;
#define INF 100000000
#define fi first
#define se second
const int LEN = 2e5 + 5;
const int LEN5 = 1e5 + 5;
const int MOD = 1e9 + 7;
typedef long long ll;
int n, m;
int dp[LEN5];
vector<int> adj[LEN5];
void sol(int x) {
if (dp[x] != -1)
return;
dp[x] = 0;
for (aut... | insert | 13 | 13 | 13 | 15 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;
template <typename T> bool chmax(T &a, cons... | #include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;
template <typename T> bool chmax(T &a, cons... | replace | 40 | 41 | 40 | 41 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define endl "\n"
#define FILEIO \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
#define LL long ... | #include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define endl "\n"
#define FILEIO \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
#define LL long ... | replace | 88 | 89 | 88 | 89 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <fstream>
#include <iostream>
#include <vector>
using namespace std;
vector<long long> adj[1000005];
long long F[1000005], a, b, n, m, dd[1000005], res;
long long dfs(long long u) {
for (long long v : adj[u])
F[u] = max(F[u], dfs(v) + 1);
return F[u];
}
int main() {
// freopen("LONGEST.INP", "r", st... | #include <fstream>
#include <iostream>
#include <vector>
using namespace std;
vector<long long> adj[1000005];
long long F[1000005], a, b, n, m, dd[1000005], res;
long long dfs(long long u) {
for (long long v : adj[u])
if (!dd[v]) {
dd[v] = 1;
F[u] = max(F[u], dfs(v) + 1);
} else
F[u] = max(F... | replace | 8 | 9 | 8 | 13 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int solve(vector<int> *edges, int n, int i, int *dp) {
int leaf = 1;
int ans = 0;
for (auto x : edges[i]) {
leaf = 0;
int t = solve(edges, n, x, dp);
ans = max(ans, t);
}
if (leaf == 1) {
return dp[i] = 0;
}
return dp[i] = 1 + ans;
}
int main()... | #include <bits/stdc++.h>
using namespace std;
int solve(vector<int> *edges, int n, int i, int *dp) {
int leaf = 1;
int ans = 0;
for (auto x : edges[i]) {
leaf = 0;
int t;
if (dp[x] == -1) {
t = solve(edges, n, x, dp);
} else {
t = dp[x];
}
ans = max(ans, t);
}
if (leaf == 1... | replace | 7 | 8 | 7 | 13 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ull unsigned long long
#define ll long long
#define M 1000000007
#define pb push_back
#define p_q priority_queue
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll, ll>
#define mii map<pii, ll>
#define all(... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ull unsigned long long
#define ll long long
#define M 1000000007
#define pb push_back
#define p_q priority_queue
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll, ll>
#define mii map<pii, ll>
#define all(... | replace | 117 | 123 | 117 | 118 | 0 | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <vector>
#define rep(i, n) for (ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
const ll MAX = 1000000;
const ll MOD = 1000000007;
ll fac[MAX];
// テーブルを作る前処理
/*
void COMinit() {
fac[0] = fac[1] = 1;
for... | #include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <vector>
#define rep(i, n) for (ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
const ll MAX = 1000000;
const ll MOD = 1000000007;
ll fac[MAX];
// テーブルを作る前処理
/*
void COMinit() {
fac[0] = fac[1] = 1;
for... | delete | 82 | 83 | 82 | 82 | -11 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define ll ... | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define ll ... | insert | 119 | 119 | 119 | 120 | TLE | |
p03166 | C++ | Time Limit Exceeded | // Program.cpp
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define fr(i, n) for (int i = 0; i < (n); ++i)
#define frC(i, n) for (int i = 0; (i < (n)) && (c); ++i)
#define frA(i, a, n) for (int i = a; i <= (n); ++i)
#define frD(i, a, n) for (... | // Program.cpp
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define fr(i, n) for (int i = 0; i < (n); ++i)
#define frC(i, n) for (int i = 0; (i < (n)) && (c); ++i)
#define frA(i, a, n) for (int i = a; i <= (n); ++i)
#define frD(i, a, n) for (... | insert | 39 | 39 | 39 | 40 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LL long long
#define ull unsigned ll
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define ff first
#define ss second
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
template <typename T> inline void sm... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LL long long
#define ull unsigned ll
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define ff first
#define ss second
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
template <typename T> inline void sm... | replace | 69 | 70 | 69 | 70 | 0 | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
vector<int> g[100];
int dp[100];
int f(int src) {
if (dp[src] != -1)
return dp[src];
int ans = 0;
int flag = 0;
for (auto i : g[src]) {
flag = 1;
ans = max(ans, f(i));
}
return dp[src] = flag == 1 ? ans + 1 : 0;
}
int main() {
memset(dp, -1, sizeof... | #include <bits/stdc++.h>
using namespace std;
#define maxx 100005
vector<int> g[maxx];
int dp[maxx];
int f(int src) {
if (dp[src] != -1)
return dp[src];
int ans = 0;
int flag = 0;
for (auto i : g[src]) {
flag = 1;
ans = max(ans, f(i));
}
return dp[src] = flag == 1 ? ans + 1 : 0;
}
int main() {
... | replace | 2 | 4 | 2 | 5 | 0 | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
vector<int> graph[10000];
int dp[1000];
int lenof(int src) {
bool leaf = 1;
if (dp[src] != -1) {
return dp[src];
}
int bestchild = 0;
for (auto child : graph[src]) {
leaf = 0;
bestchild = max(bestchild, lenof(child));
}
return d... | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
vector<int> graph[100001];
int dp[100001];
int lenof(int src) {
bool leaf = 1;
if (dp[src] != -1) {
return dp[src];
}
int bestchild = 0;
for (auto child : graph[src]) {
leaf = 0;
bestchild = max(bestchild, lenof(child));
}
retur... | replace | 3 | 5 | 3 | 5 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define ff(i, x, n, k) for (int i = x; i < n; i += k)
#define rf(i, x, n, k) for (int i = n - 1; i >= x; i += k)
#define ef(i, x, n, k) for (int i = x; i <= n; i += k)
#define pb push_back
#define eb emplace... | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define ff(i, x, n, k) for (int i = x; i < n; i += k)
#define rf(i, x, n, k) for (int i = n - 1; i >= x; i += k)
#define ef(i, x, n, k) for (int i = x; i <= n; i += k)
#define pb push_back
#define eb emplace... | insert | 29 | 29 | 29 | 32 | TLE | |
p03166 | C++ | Time Limit Exceeded | // hail to jwalaji
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
vector<vector<lli>> adj(100005, vector<lli>());
vector<lli> store(100005, -1);
lli dfs(lli u, lli parent = -1) {
lli maxa = 1;
lli storemax = 0;
for (auto &v : adj[u]) {
if (v == parent)
continue;
else {
... | // hail to jwalaji
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
vector<vector<lli>> adj(100005, vector<lli>());
vector<lli> store(100005, -1);
lli dfs(lli u, lli parent = -1) {
lli maxa = 1;
lli storemax = 0;
for (auto &v : adj[u]) {
if (v == parent)
continue;
else {
... | replace | 13 | 14 | 13 | 17 | TLE | |
p03166 | C++ | Runtime Error | #define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using ll = long long;
using namespace std;
ll mod = 1000000007;
ll n_pow(ll a, ll n) {
if... | #define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using ll = long long;
using namespace std;
ll mod = 1000000007;
ll n_pow(ll a, ll n) {
if... | replace | 32 | 33 | 32 | 33 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i, a, n) for (int i = a; i < (int)n; i++)
#define rf(i, n, a) for (int i = n; i >= a; i--)
#define F first
#define S second
#define all(c) (c).begin(), (c).end()
#define sz(v) (i... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i, a, n) for (int i = a; i < (int)n; i++)
#define rf(i, n, a) for (int i = n; i >= a; i--)
#define F first
#define S second
#define all(c) (c).begin(), (c).end()
#define sz(v) (i... | insert | 34 | 34 | 34 | 35 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
int memo[N];
bool vis[N];
vector<int> g[N];
int dp(int u) {
if (vis[u])
return memo[u];
int ans = 0;
for (auto v : g[u]) {
ans = max(ans, dp(v) + 1);
}
vis[u] = true;
return memo[u] = ans;
}
int main() {
int n, m;
cin >> n >... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int memo[N];
bool vis[N];
vector<int> g[N];
int dp(int u) {
if (vis[u])
return memo[u];
int ans = 0;
for (auto v : g[u]) {
ans = max(ans, dp(v) + 1);
}
vis[u] = true;
return memo[u] = ans;
}
int main() {
int n, m;
cin >> n >... | replace | 2 | 3 | 2 | 3 | 0 | |
p03166 | C++ | Time Limit Exceeded | #pragma GCC optimize "trapv"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define rep3(n) for (int i = 0; i < n; i++)
#define inarr(arr, n) rep(i, a, n) cin >> arr[i]
#define ll long long int
#define pb push_back
... | #pragma GCC optimize "trapv"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define rep3(n) for (int i = 0; i < n; i++)
#define inarr(arr, n) rep(i, a, n) cin >> arr[i]
#define ll long long int
#define pb push_back
... | replace | 43 | 44 | 43 | 47 | TLE | |
p03166 | C++ | Runtime Error | /* よろしくお願いします
LEARNING DP: Longest Path
+ SIMPLE GRAPH
+ DIRECTED EDGES
+ NO CYCLE
CONSTRAINT:
+2 <= N <= 1e5
+1 <= M <= 1e5
QUESTION:
+ can we START at RANDOM Vertex
+ what should we memorize after done a DFS or BFS
IF WE KNOW:
A PATH ... | /* よろしくお願いします
LEARNING DP: Longest Path
+ SIMPLE GRAPH
+ DIRECTED EDGES
+ NO CYCLE
CONSTRAINT:
+2 <= N <= 1e5
+1 <= M <= 1e5
QUESTION:
+ can we START at RANDOM Vertex
+ what should we memorize after done a DFS or BFS
IF WE KNOW:
A PATH ... | replace | 27 | 28 | 27 | 28 | 0 | |
p03166 | C++ | Runtime Error | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#define ll long long
using namespace std;
vector<int> dp(10010, 0);
vector<vector<int>> g(10010, vector<int>());
int N, M;
int dfs(int u) {
if (dp[u])
return dp[u];
int cu = 0;
... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#define ll long long
using namespace std;
vector<int> dp(100010, 0);
vector<vector<int>> g(100010, vector<int>());
int N, M;
int dfs(int u) {
if (dp[u])
return dp[u];
int cu = 0;... | replace | 11 | 13 | 11 | 13 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> viii;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repu(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, b, a) for (int i = b; i >= a; i--)
#define pb push_back
#define... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> viii;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repu(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, b, a) for (int i = b; i >= a; i--)
#define pb push_back
#define... | replace | 47 | 50 | 47 | 48 | TLE | |
p03166 | C++ | Runtime Error | // People only find me interesting because they can't tell whether I'm serious
// or not #include <boost/multiprecision/cpp_int.hpp>
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
typedef long long int ll;
typedef double db;
typedef __int128 s128;
typedef __uint12... | // People only find me interesting because they can't tell whether I'm serious
// or not #include <boost/multiprecision/cpp_int.hpp>
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
typedef long long int ll;
typedef double db;
typedef __int128 s128;
typedef __uint12... | replace | 32 | 33 | 32 | 33 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define FOR(k, m, n) for (ll(k) = (m); (k) < (n); (k)++)
#define REP(i, n) FOR((i), 0, (n))
#define WAITING(str) \... | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define FOR(k, m, n) for (ll(k) = (m); (k) < (n); (k)++)
#define REP(i, n) FOR((i), 0, (n))
#define WAITING(str) \... | insert | 24 | 24 | 24 | 26 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#define ll long long
#define ull unsigned long long
#define make(type, x) \
type x; ... | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#define ll long long
#define ull unsigned long long
#define make(type, x) \
type x; ... | insert | 113 | 113 | 113 | 115 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#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)
#define scf(t) scanf("%f", &t)
#define sclf(t) scanf("%lf", &t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#defin... | #include <bits/stdc++.h>
using namespace std;
#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)
#define scf(t) scanf("%f", &t)
#define sclf(t) scanf("%lf", &t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#defin... | insert | 59 | 59 | 59 | 60 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long int i = 0; i < n; i++)
#define foi(i, a, n) for (long long int i = a; i < n; i++)
#define el "\n"
const int INF = 2e9 + 5;
const int MAX = 1e5 + 5;
using ll = long long int;
vector<int> vis(MAX, 0), dp(MAX, 0), deg(MAX, 0);
void dfs(vector<... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long int i = 0; i < n; i++)
#define foi(i, a, n) for (long long int i = a; i < n; i++)
#define el "\n"
const int INF = 2e9 + 5;
const int MAX = 1e5 + 5;
using ll = long long int;
vector<int> vis(MAX, 0), dp(MAX, 0), deg(MAX, 0);
void dfs(vector<... | replace | 33 | 34 | 33 | 34 | TLE | |
p03166 | C++ | Time Limit Exceeded | #pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using boost::multiprecision::cpp_int;
using namespace std;
#define fast \
ios_base::sync_with_stdio(false)... | #pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using boost::multiprecision::cpp_int;
using namespace std;
#define fast \
ios_base::sync_with_stdio(false)... | replace | 43 | 45 | 43 | 47 | TLE | |
p03166 | C++ | Time Limit Exceeded | // mangesh2102000
#include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(... | // mangesh2102000
#include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(... | insert | 23 | 23 | 23 | 24 | TLE | |
p03166 | C++ | Time Limit Exceeded |
// Problem : G - Longest Path
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_g
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <e... |
// Problem : G - Longest Path
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_g
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <e... | insert | 119 | 119 | 119 | 121 | TLE | |
p03166 | C++ | Time Limit Exceeded | // #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;
int n, m;
vvi G;
vi check;
int dfs(int i) {
if (check[i] != -1) {
return check[i];
}
if (!G[i].size()) {
check[i] = 0;... | // #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;
int n, m;
vvi G;
vi check;
int dfs(int i) {
if (check[i] != -1) {
return check[i];
}
if (!G[i].size()) {
check[i] = 0;... | insert | 25 | 25 | 25 | 26 | TLE | |
p03166 | C++ | Runtime Error | // #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mp make_pair
#define pi pair<int, int>
#define pl pair<long long int, long long int>
... | // #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mp make_pair
#define pi pair<int, int>
#define pl pair<long long int, long long int>
... | replace | 17 | 18 | 17 | 18 | 0 | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>,
// rb_tree_tag,tree_order_statisti... | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>,
// rb_tree_tag,tree_order_statisti... | delete | 56 | 60 | 56 | 56 | -11 | |
p03166 | C++ | Time Limit Exceeded | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
template <typename T1, typename T2> inli... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
template <typename T1, typename T2> inli... | replace | 36 | 37 | 36 | 39 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include ... | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include ... | insert | 47 | 47 | 47 | 49 | TLE | |
p03166 | C++ | Runtime Error | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <utility>
#include <vector>
#define ALL(obj) (obj).be... | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <utility>
#include <vector>
#define ALL(obj) (obj).be... | replace | 37 | 38 | 37 | 38 | -11 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ordered_set \
tree<int, null_type, less<int>, rb_tree_tag, \
... | #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 ordered_set \
tree<int, null_type, less<int>, rb_tree_tag, \
... | replace | 47 | 49 | 47 | 51 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
template <typename T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
int main() {
ios::sync_with_stdi... | #include <bits/stdc++.h>
using namespace std;
template <typename T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
int main() {
ios::sync_with_stdi... | insert | 47 | 47 | 47 | 49 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> G;
vector<int> memo;
int dp(int u) {
if (memo[u] != -1)
return memo[u];
int res = 0;
for (auto v : G[u]) {
res = max(res, dp(v) + 1);
}
return res;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, M;
cin >> N >... | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> G;
vector<int> memo;
int dp(int u) {
if (memo[u] != -1)
return memo[u];
int res = 0;
for (auto v : G[u]) {
res = max(res, dp(v) + 1);
}
return memo[u] = res;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, M;
... | replace | 14 | 15 | 14 | 15 | TLE | |
p03166 | C++ | Time Limit Exceeded |
// Problem : G - Longest Path
// Contest : Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_g
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)
#include <bits/stdc++.h>
using namespace std;
vector<int> adj[(int)1e5 + 5], rev[(int)... |
// Problem : G - Longest Path
// Contest : Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_g
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)
#include <bits/stdc++.h>
using namespace std;
vector<int> adj[(int)1e5 + 5], rev[(int)... | replace | 15 | 16 | 15 | 17 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int MAXN = 10101;
vector<int> AdList[MAXN];
int n, m, dp[MAXN];
int maxdfs(int i) {
if (dp[i] != -1)
return dp[i];
int mpath = 0;
for (auto u : AdList[i]) {
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int MAXN = 101010;
vector<int> AdList[MAXN];
int n, m, dp[MAXN];
int maxdfs(int i) {
if (dp[i] != -1)
return dp[i];
int mpath = 0;
for (auto u : AdList[i]) {
... | replace | 8 | 9 | 8 | 9 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include "bits/stdc++.h"
using namespace std;
#define LIM 100003
#define M 1000000007
#define inf 99999999999999999LL // long long inf
typedef long long ll;
#define sc(x) scanf("%d", &x);
#define sc2(x, y) scanf("%d%d", &x, &y);
#define sc3(x, y, z) scanf("%d%d%d", &x, &y, &z);
#define scl(x) scanf("%lld", &x);
#defin... | #include "bits/stdc++.h"
using namespace std;
#define LIM 100003
#define M 1000000007
#define inf 99999999999999999LL // long long inf
typedef long long ll;
#define sc(x) scanf("%d", &x);
#define sc2(x, y) scanf("%d%d", &x, &y);
#define sc3(x, y, z) scanf("%d%d%d", &x, &y, &z);
#define scl(x) scanf("%lld", &x);
#defin... | insert | 43 | 43 | 43 | 44 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 5;
struct Edge {
int to;
int nxt;
} edges[mx];
int head[mx], depth[mx], tot;
void AddEdge(int u, int v) {
edges[tot].to = v;
edges[tot].nxt = head[u];
head[u] = tot++;
}
int DFS(int cur) {
if (depth[cur])
return depth[cur];
// ... | #include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 5;
struct Edge {
int to;
int nxt;
} edges[2 * mx]; // virtual vertex
int head[mx], depth[mx], tot;
void AddEdge(int u, int v) {
edges[tot].to = v;
edges[tot].nxt = head[u];
head[u] = tot++;
}
int DFS(int cur) {
if (depth[cur])
retur... | replace | 8 | 9 | 8 | 9 | 0 | |
p03166 | C++ | Memory Limit Exceeded | #include <algorithm>
#include <iostream>
#include <memory>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int dfs(int n, vector<vector<int>> &adjl, vector<int> &dp) {
if (dp[n] != -1)
return dp[n];
int &ret = dp[n];
ret = 0;
for (int i = 0; i < adjl[n].size(); i++)
ret = max... | #include <algorithm>
#include <iostream>
#include <memory>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int dfs(int n, vector<vector<int>> &adjl, vector<int> &dp) {
if (dp[n] != -1)
return dp[n];
int &ret = dp[n];
ret = 0;
for (int i = 0; i < adjl[n].size(); i++)
ret = max... | delete | 22 | 23 | 22 | 22 | MLE | |
p03166 | C++ | Time Limit Exceeded | // Bismillahirrahmanirrahim
// █▀█─█──█──█▀█─█─█
// █▄█─█──█──█▄█─█▄█
// █─█─█▄─█▄─█─█─█─█
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair<lo, lo> PII;
#define fi f... | // Bismillahirrahmanirrahim
// █▀█─█──█──█▀█─█─█
// █▄█─█──█──█▄█─█▄█
// █─█─█▄─█▄─█─█─█─█
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair<lo, lo> PII;
#define fi f... | replace | 50 | 51 | 50 | 51 | TLE | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
vector<int> g[110000];
int dp[11000];
int solve(int i) {
if (dp[i] != -1)
return dp[i];
int ret = 0;
for (int j = 0; j < g[i].size(); j++) {
ret = max(ret, solve(g[i][j]) + 1);
}
dp[i] = ret;
return dp[i];
}
int main() {
int n, m;
int u, v;
cin >> ... | #include <bits/stdc++.h>
using namespace std;
vector<int> g[110000];
int dp[110000];
int solve(int i) {
if (dp[i] != -1)
return dp[i];
int ret = 0;
for (int j = 0; j < g[i].size(); j++) {
ret = max(ret, solve(g[i][j]) + 1);
}
dp[i] = ret;
return dp[i];
}
int main() {
int n, m;
int u, v;
cin >>... | replace | 3 | 4 | 3 | 4 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = (int)1e5 + 5;
int n, m;
vector<int> g[N];
int dp[N];
void calc(int nod) {
dp[nod] = 1;
for (auto &nou : g[nod]) {
calc(nou);
dp[nod] = max(dp[nod], 1 + dp[nou]);
}
}
int main() {
ios_base::syn... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = (int)1e5 + 5;
int n, m;
vector<int> g[N];
int dp[N];
void calc(int nod) {
dp[nod] = 1;
for (auto &nou : g[nod]) {
if (dp[nou] == 0)
calc(nou);
dp[nod] = max(dp[nod], 1 + dp[nou]);
}
}
int ... | replace | 16 | 17 | 16 | 18 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll input() {
ll x = 0, f = 0;
char ch = getchar();
while (ch < '0' || ch > '9')
f |= ch == '-', ch = getchar();
while (ch >= '0' && ch <= '9')
x = x * 10 + ch - '0', ch = getchar();
return f ? -x : x;
}
#define ll long long
const in... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll input() {
ll x = 0, f = 0;
char ch = getchar();
while (ch < '0' || ch > '9')
f |= ch == '-', ch = getchar();
while (ch >= '0' && ch <= '9')
x = x * 10 + ch - '0', ch = getchar();
return f ? -x : x;
}
#define ll long long
const in... | replace | 34 | 38 | 34 | 37 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int N, M;
vector<int> g[maxn];
int DP[maxn];
bool vis[maxn];
void DFS(int v, int p) {
DP[v] = 1;
for (int u : g[v]) {
if (u != p) {
DFS(u, v);
DP[v] = max(DP[v], DP[u] + 1);
}
}
}
int main() {
ios::sync_with_stdio(fa... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int N, M;
vector<int> g[maxn];
int DP[maxn];
bool vis[maxn];
void DFS(int v, int p) {
DP[v] = 1;
for (int u : g[v]) {
if (u != p) {
if (!DP[u])
DFS(u, v);
DP[v] = max(DP[v], DP[u] + 1);
}
}
}
int main() {
ios... | replace | 13 | 14 | 13 | 15 | TLE | |
p03166 | C++ | Time Limit Exceeded | #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 ... | insert | 32 | 32 | 32 | 33 | TLE | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
void traverse(vector<int> &distances, vector<vector<int>> &adjList,
vector<bool> visited, int node) {
visited[node] = true;
for (int i = 0; i < adjList[node].size(); i++) {
if (!visited[adjList[node][i]])
traverse(distances, adjList, visited, a... | #include <bits/stdc++.h>
using namespace std;
void traverse(vector<int> &distances, vector<vector<int>> &adjList,
vector<bool> &visited, int node) {
visited[node] = true;
for (int i = 0; i < adjList[node].size(); i++) {
if (!visited[adjList[node][i]])
traverse(distances, adjList, visited, ... | replace | 5 | 6 | 5 | 6 | TLE | |
p03166 | C++ | Runtime Error | /*Template by hemnath_d(Enlightened by chamow)*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec vector<ll>
#define pll pair<ll, ll>
#define fastread \
ios_base::sync_with_stdio(false); ... | /*Template by hemnath_d(Enlightened by chamow)*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec vector<ll>
#define pll pair<ll, ll>
#define fastread \
ios_base::sync_with_stdio(false); ... | replace | 16 | 17 | 16 | 17 | 0 | |
p03166 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef array<ll, 2> pll;
const ll NMAX = 10005;
ll dp[NMAX], deg[NMAX];
vector<ll> edg[NMAX];
int main() {
ll n, m, a... | #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;
typedef long long ll;
typedef long double ld;
typedef array<ll, 2> pll;
const ll NMAX = 100005;
ll dp[NMAX], deg[NMAX];
vector<ll> edg[NMAX];
int main() {
ll n, m, ... | replace | 9 | 10 | 9 | 10 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> adj[N];
bool vis[N];
int dp[N], ans;
void dfs(int u) {
for (auto v : adj[u]) {
if (!vis[v])
dfs(v);
dp[u] = max(dp[u], dp[v] + 1);
}
}
int main() {
int n, m;
cin >> n >> m;
int x, y;
for (int i = 1; i <= m; i... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> adj[N];
bool vis[N];
int dp[N], ans;
void dfs(int u) {
vis[u] = true;
for (auto v : adj[u]) {
if (!vis[v])
dfs(v);
dp[u] = max(dp[u], dp[v] + 1);
}
}
int main() {
int n, m;
cin >> n >> m;
int x, y;
for (int... | insert | 10 | 10 | 10 | 11 | TLE | |
p03166 | C++ | Runtime Error | /* be name Khoda */
// VJUDGE
#include <bits/stdc++.h>
using namespace std;
const int N = 100 * 100;
int dp[N], n, m;
vector<int> adj[N];
bool mark[N];
void dfs(int u) {
mark[u] = true;
for (auto v : adj[u]) {
if (!mark[v]) {
dfs(v);
dp[u] = max(dp[u], dp[v] + 1);
}
dp[u] = max(dp[u], dp[v... | /* be name Khoda */
// VJUDGE
#include <bits/stdc++.h>
using namespace std;
const int N = 100 * 1001;
int dp[N], n, m;
vector<int> adj[N];
bool mark[N];
void dfs(int u) {
mark[u] = true;
for (auto v : adj[u]) {
if (!mark[v]) {
dfs(v);
dp[u] = max(dp[u], dp[v] + 1);
}
dp[u] = max(dp[u], dp[... | replace | 5 | 6 | 5 | 6 | 0 | |
p03166 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int n, m, k, u, v, fix[100005], length[100005], ans;
vector<int> V[100005];
int go(int u) {
if (fix[u])
return length[u];
for (int i = 0; i < V[u].size(); i++) {
length[u] = max(length[u], go(V[u][i]) + 1);
}
return length[u];
}
int main() {
cin >> n >> ... | #include <bits/stdc++.h>
using namespace std;
int n, m, k, u, v, fix[100005], length[100005], ans;
vector<int> V[100005];
int go(int u) {
if (fix[u])
return length[u];
fix[u] = 1;
for (int i = 0; i < V[u].size(); i++) {
length[u] = max(length[u], go(V[u][i]) + 1);
}
return length[u];
}
int main() {
... | replace | 8 | 9 | 8 | 9 | TLE | |
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int dx[2] = {-1, 0};
int dy[2] = {0, -1};
long long vec[555][555];
int MOD = 1e9 + 7;
int main() {
int h, w;
cin >> h >> w;
vector<string> board(h, "");
for (int i = 0; i < h; ++i) {
cin >> board[i];
}
if (board[0][0] != '#')
vec[0][0] = 1;
for (int i ... | #include <bits/stdc++.h>
using namespace std;
int dx[2] = {-1, 0};
int dy[2] = {0, -1};
long long vec[1010][1010];
int MOD = 1e9 + 7;
int main() {
int h, w;
cin >> h >> w;
vector<string> board(h, "");
for (int i = 0; i < h; ++i) {
cin >> board[i];
}
if (board[0][0] != '#')
vec[0][0] = 1;
for (int ... | replace | 4 | 5 | 4 | 5 | 0 | |
p03167 | C++ | Runtime Error | #include <iostream>
using namespace std;
static int grid[1000][1000];
static uint path_count[1000][1000];
static const uint mod = 1'000'000'007;
int main() {
int h, w;
cin >> h >> w;
for (auto row = 0; row < h; row++) {
for (auto col = 0; col < w; col++) {
char c;
cin >> c;
grid[row][col]... | #include <iostream>
using namespace std;
static int grid[1000][1000];
static uint path_count[1000][1000];
static const uint mod = 1'000'000'007;
int main() {
int h, w;
cin >> h >> w;
for (auto row = 0; row < h; row++) {
for (auto col = 0; col < w; col++) {
char c;
cin >> c;
grid[row][col]... | insert | 23 | 23 | 23 | 25 | 0 | |
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define popb pop_back
#define beg begin()
#define en end()
#define sz(v) (int)((v).size())
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define endl "\n"
#define forn(i, a, n) for ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define popb pop_back
#define beg begin()
#define en end()
#define sz(v) (int)((v).size())
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define endl "\n"
#define forn(i, a, n) for ... | replace | 45 | 46 | 45 | 46 | 0 | |
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define MAX 100007
#define MOD 1000000007
int b[105][105];
long long output[105][105];
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
char x;
cin >> x;
if (x == '.')
b[i][j] = 0;
... | #include <bits/stdc++.h>
using namespace std;
#define MAX 100007
#define MOD 1000000007
int b[1005][1005];
long long output[1005][1005];
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
char x;
cin >> x;
if (x == '.')
b[i][j] = 0;
... | replace | 4 | 6 | 4 | 6 | 0 | |
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define mp make_pair
#define S second
#define F first
ll mod = 1e9 + 7;
#define input_from_file freopen("input.txt", "r", stdin);
int main() {
input_from_file;
ll n, k, m, u, v;
cin >> n >> m;
vector<vector<char>> vec(n... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define mp make_pair
#define S second
#define F first
ll mod = 1e9 + 7;
#define input_from_file freopen("input.txt", "r", stdin);
int main() {
// input_from_file;
ll n, k, m, u, v;
cin >> n >> m;
vector<vector<char>> ve... | replace | 11 | 12 | 11 | 12 | -6 | terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
|
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef set<int> si;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef map<string, int> msi;
typedef set<ll> sl;
t... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef set<int> si;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef map<string, int> msi;
typedef set<ll> sl;
t... | delete | 31 | 35 | 31 | 31 | -11 | |
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
#define ll long long
#define ld long double
#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 F first
#define S second
#define sz(x) (int)x.size()
#defi... | #include <bits/stdc++.h>
#define ll long long
#define ld long double
#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 F first
#define S second
#define sz(x) (int)x.size()
#defi... | replace | 39 | 40 | 39 | 40 | 0 | |
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#define MOD 1000000007
#define pb push_back
#define fi first
#define se second
#define fr front()
#define ba back()
#define tp top()
#define mem(x, n) memset(x, n, sizeof(x));
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
... | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#define MOD 1000000007
#define pb push_back
#define fi first
#define se second
#define fr front()
#define ba back()
#define tp top()
#define mem(x, n) memset(x, n, sizeof(x));
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
... | insert | 49 | 49 | 49 | 53 | 0 | |
p03167 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int D[1002][1002];
int MD = 1e9 + 7;
int main() {
int H, W;
cin >> H >> W;
char M[1002][1002];
for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++)
cin >> M[i][j];
}
D[0][1] = 1;
for (int i = 1; i <= H; i... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int D[1002][1002];
int MD = 1e9 + 7;
int main() {
int H, W;
cin >> H >> W;
char M[1002][1002];
for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++)
cin >> M[i][j];
}
D[0][1] = 1;
for (int i = 1; i <= H; i... | delete | 26 | 33 | 26 | 26 | TLE | |
p03167 | Python | Runtime Error | def paths(i, j):
if i == h - 1 and j == w - 1:
return 1
if a[i][0][j] == "#":
return 0
if i < h - 1 and j < w - 1:
if dp[i][j] == -1:
dp[i][j] = paths(i + 1, j) + paths(i, j + 1)
return dp[i][j]
else:
return dp[i][j]
elif i == h - 1 and... | import sys
sys.setrecursionlimit(20000)
def paths(i, j):
if i == h - 1 and j == w - 1:
return 1
if a[i][0][j] == "#":
return 0
if i < h - 1 and j < w - 1:
if dp[i][j] == -1:
dp[i][j] = paths(i + 1, j) + paths(i, j + 1)
return dp[i][j]
else:
... | insert | 0 | 0 | 0 | 5 | 0 | |
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
template <class Type> inline bool chmax(Type &a, Type b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class Type> inline bool chmin(Type &a, Type b) {
if (a > b) {
a = b;
return 1;
}
return 0... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
template <class Type> inline bool chmax(Type &a, Type b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class Type> inline bool chmin(Type &a, Type b) {
if (a > b) {
a = b;
return 1;
}
return 0... | replace | 110 | 111 | 110 | 111 | -11 | |
p03167 | 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 | 110 | 113 | 110 | 111 | -11 | |
p03167 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
char a[1919][1919];
ll dp[1919][1919];
signed main()... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
char a[1919][1919];
ll dp[1919][1919];
signed main()... | insert | 24 | 24 | 24 | 28 | 0 | |
p03167 | C++ | Time Limit Exceeded | /////////////////////////////////TEST CASES////////////////////////////////////
/*
*/
/////////////////////////////////////CODE//////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = a; i > b; i--)
#defin... | /////////////////////////////////TEST CASES////////////////////////////////////
/*
*/
/////////////////////////////////////CODE//////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = a; i > b; i--)
#defin... | replace | 30 | 33 | 30 | 34 | TLE | |
p03167 | 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[105][105];
int main() {
// std::cout << std::fixed << std::setprec... | #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[1005][1005];
int main() {
// std::cout << std::fixed << std::setpr... | replace | 14 | 15 | 14 | 15 | 0 | |
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
#define fastread \
std::ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define endl '\n'
#define pb push... | #include <bits/stdc++.h>
#define fastread \
std::ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define endl '\n'
#define pb push... | delete | 27 | 31 | 27 | 27 | -11 | |
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fs \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fs \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); ... | replace | 10 | 12 | 10 | 12 | 0 | |
p03167 | C++ | Time Limit Exceeded | // code.begin();
#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 pb push_back
#define what_is(x) cerr << #x << " is " << x << endl;
#define print(v) ... | // code.begin();
#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 pb push_back
#define what_is(x) cerr << #x << " is " << x << endl;
#define print(v) ... | replace | 118 | 119 | 118 | 136 | TLE | |
p03167 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
int n, m, dp[1005][1005];
char a[1005][1005];
int solve(int i, int j) {
if (i == n && j == m)
return 1;
if (dp[i][j] != -1)
return dp[i][j];
int cur = 0;
if (i + 1 <= n && a[i + 1][j] == '.')
cur += solve(i + 1, j) % mo... | #include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
int n, m, dp[1005][1005];
char a[1005][1005];
int solve(int i, int j) {
if (i == n && j == m)
return 1;
if (dp[i][j] != -1)
return dp[i][j];
int cur = 0;
if (i + 1 <= n && a[i + 1][j] == '.') {
dp[i + 1][j] = solve(i + ... | replace | 16 | 21 | 16 | 31 | TLE | |
p03167 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define forloop for (int i = 0; i < n; i++)
#define pb push_back
#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define MOD 998244353;
#define unmap unordered_map
#define pi 3.1415926536
#define testcases ... | #include <bits/stdc++.h>
using namespace std;
#define forloop for (int i = 0; i < n; i++)
#define pb push_back
#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define MOD 998244353;
#define unmap unordered_map
#define pi 3.1415926536
#define testcases ... | replace | 28 | 29 | 28 | 29 | TLE | |
p03167 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pll;
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define rad(X) cout << (X) << endl
#define ASH(X) cout << (X) << " "
#define debug(x) cout << #x << " " << x << endl;
#define debug2(x, y) cout << #x <... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pll;
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define rad(X) cout << (X) << endl
#define ASH(X) cout << (X) << " "
#define debug(x) cout << #x << " " << x << endl;
#define debug2(x, y) cout << #x <... | replace | 40 | 42 | 40 | 42 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.