id int64 251M 307M | language stringclasses 11
values | verdict stringclasses 119
values | source stringlengths 0 60.3k | problem_id stringclasses 500
values | type stringclasses 2
values | difficulty stringclasses 4
values |
|---|---|---|---|---|---|---|
278,842,015 | Python 3 | WRONG_ANSWER on test 2 | from sys import stdin, stdout
from collections import defaultdict,deque
input = stdin.readline
inp = lambda : list(map(int,input().split()))
inps= lambda : input().strip()
inpsl= lambda : list(input().strip().split())
import math,random
MOD = 1000000007
class CustomSet:
def __init__(self, arr = []):
self.R... | 2006A | wrong_submission | hard |
278,840,847 | PyPy 3-64 | WRONG_ANSWER on test 2 | for _ in range(int(input())):
n=int(input())
tr=[[] for i in range(n)]
for i in range(n-1):
u,v=map(int,input().split())
tr[u-1].append(v-1)
tr[v-1].append(u-1)
s=input()
li=[]
co=s.count("?")
for i in range(1,n):
if len(tr[i])==1:
li.append(i)
... | 2006A | wrong_submission | hard |
279,018,400 | Python 3 | WRONG_ANSWER on test 2 | import math
t = int(input())
for _ in range(t):
n = int(input())
adj = [[]for _ in range(n)]
for _ in range(n-1):
u,v = map(int,input().split())
u,v = min(u,v),max(u,v)
adj[u-1].append(v-1)
s = input()
c0 = 0
c1 = 0
c2 = 0
cnt = s.count('?')
for node in range... | 2006A | wrong_submission | hard |
278,866,357 | Java 8 | WRONG_ANSWER on test 6 | import java.util.*;
import java.io.*;
public class Main {
static PrintWriter pw = new PrintWriter(System.out);
static Scanner sc = new Scanner(System.in) ;
static ArrayList<Integer> adjl [];
public static void solve() throws IOException {
int n = sc.nextInt();
adjl = new ArrayList[... | 2006A | wrong_submission | hard |
278,849,915 | C++17 (GCC 7-32) | MEMORY_LIMIT_EXCEEDED on test 8 | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define IN(i,l,r) (l<i&&i<r)
#define FOR(i,L,R) for (int i = L; i < R; i++)
#define FORE(i,L,R) for (int i = L; i <= R; i++)
#define FFOR(i,L,R) for (int i = L; i > R; i--)
#define FFORE(i,L,R) for (int i = L; i >= R; i--)
#define ll long long
int c0=0... | 2006A | wrong_submission | hard |
276,596,867 | C++20 (GCC 13-64) | OK | #include <bits/stdc++.h>
using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;
constexpr int N = 1E7;
int sg[N + 1];
std::vector<int> minp, primes;
void sieve(int n) {
minp.assign(n + 1, 0);
primes.clear();
for (int i = 2; i <= n; i++) {
if (minp[i] == 0) {
... | 2004E | right_submission | none |
281,342,331 | C++17 (GCC 7-32) | OK | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#pragma GCC optimize ("trapv")
using namespace std;
#define pii pair<int, int>
#define pll pair<long long, long long>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define DEBUG 1
#define cerr if (DEBUG) cerr
#define te... | 2004E | right_submission | none |
277,586,104 | C++20 (GCC 13-64) | OK | // They say that life is always easier
// After you let yourself come undone
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 10;
const int V = 1e7 + 10;
int n, fac[V], id[V], SG[N];
vector<int> p;
int Qry(int x) {
if(x & 1) return id[fac[x]];
else return 0;
}
void Init() {
n =... | 2004E | right_submission | none |
276,711,904 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
#define all(x) x.begin(), x.end()
#define sz(x) ((int) ((x).size()))
#define pb push_back
#define F first
#define S second
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int n;
int s[1000010];
ma... | 2004E | wrong_submission | easy |
279,365,235 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define ul unsigned long long
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vpl vector<pll>
#define vpi vector<pii>
#define vvi vector<vi>
#define vvl ve... | 2004E | wrong_submission | easy |
276,651,695 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #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;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef unsigned long long ... | 2004E | wrong_submission | easy |
279,978,829 | Python 3 | WRONG_ANSWER on test 2 | import math
def is_prime(n):
if n < 2:
return False
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
return False
return True
def solve():
n = int(input())
a = list(map(int, input().split()))
primes = 0
for x in a:
if is_prime(x):
p... | 2004E | wrong_submission | easy |
294,898,501 | Python 3 | WRONG_ANSWER on test 2 | import math
from typing import List
def gcd(a: int, b: int) -> int:
"""Compute the Greatest Common Divisor of a and b."""
while b != 0:
a, b = b, a % b
return a
def primeFactors(n: int) -> List[int]:
"""Return list of prime factors of n, excluding 'n' itself."""
factors = []
# Check ... | 2004E | wrong_submission | easy |
279,012,966 | Python 3 | WRONG_ANSWER on test 2 | t = int(input())
for _ in range(t):
n = int(input())
input()
print("Alice" if n % 2 == 0 else "Bob") | 2004E | wrong_submission | easy |
276,679,006 | Java 21 | WRONG_ANSWER on test 2 | import java.util.*;
public class Codechef {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt(), a[] = new int[n];
HashSet<Integer> hs = new HashSet<>();
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
if... | 2004E | wrong_submission | easy |
277,308,652 | Java 8 | WRONG_ANSWER on test 2 | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.O... | 2004E | wrong_submission | easy |
276,831,256 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include <bits/stdc++.h>
using namespace std;
#define fastio std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define nl "\n"
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define show(C) for (auto J: C) cout << J << " ";cout << endl;
const ll MAX = 1e7+3;
vector<ll>grundy(MAX, -1);
vector<ll>... | 2004E | wrong_submission | medium |
276,619,280 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #ifndef VLSMB_VS
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip>
#include <set>
#include <algorithm>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <cstdio>
#include <cmath>
#endif
#define int long long
#define pii pair<int,int>
#de... | 2004E | wrong_submission | medium |
276,673,597 | PyPy 3-64 | WRONG_ANSWER on test 2 | import sys
input = sys.stdin.readline
def is_prime(num):
if num == 1:
return False
for i in range(2, int(num**0.5)+1):
if num%i == 0:
return False
return True
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
... | 2004E | wrong_submission | medium |
299,827,742 | PyPy 3-64 | WRONG_ANSWER on test 2 | import sys
input = sys.stdin.buffer.readline
from collections import Counter
def gcd(x, y):
"""greatest common divisor of x and y"""
while y:
x, y = y, x % y
return x
def memodict(f):
"""memoization decorator for a function taking a single argument"""
class memodict(dict):
... | 2004E | wrong_submission | medium |
287,908,672 | Java 21 | WRONG_ANSWER on test 2 | import java.io.*;
import java.util.*;
public class Main {
static HashSet<Integer> primeSet;
static int[] firstPrimeArr;
static int maxNum = (int) (1e7);
static void findAllprimes(int maxNum) {
boolean[] arr = new boolean[maxNum + 1];
fo... | 2004E | wrong_submission | medium |
276,676,016 | Java 21 | TIME_LIMIT_EXCEEDED on test 2 | import java.util.*;
public class Codechef {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt(), a[] = new int[n];
int r[] = new int[10000001];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
r[a[i]] = (r... | 2004E | wrong_submission | medium |
276,757,319 | C++20 (GCC 13-64) | WRONG_ANSWER on test 3 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 10, M = 1e7;
int t, n, primes[N], sg[N];
int main() {
sg[0] = 0, sg[1] = 1, sg[2] = 0;
int cnt = 0, tot = 1;
for (int i = 3; i <= M; i += 2 ) {
if (!sg[i]) {
sg[i] = ++ tot;
primes[cnt ++ ] = i;
... | 2004E | wrong_submission | hard |
284,775,117 | C++20 (GCC 13-64) | RUNTIME_ERROR on test 3 | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 1E3 + 5;
int sg[N];
void init() {
for (int i = 1 ; i < N ; ++i) {
set<int> P;
for (int j = 1 ; j <= i ; ++j) {
if (__gcd(i , j) == 1) {
P.insert(sg[i - j]);
}
}
while (P.count(sg[i])) sg[i] += 1;
}
}
void solve()... | 2004E | wrong_submission | hard |
276,671,480 | PyPy 3-64 | TIME_LIMIT_EXCEEDED on test 3 | import math
from functools import lru_cache
import sys
@lru_cache(None)
def gcd(a, b):
return math.gcd(a, b)
@lru_cache(None)
def valid_moves(x):
moves = []
for y in range(1, x + 1):
if gcd(x, y) == 1:
moves.append(y)
return moves
@lru_cache(None)
def calculate_grundy(x):
i... | 2004E | wrong_submission | hard |
277,255,247 | Python 3 | TIME_LIMIT_EXCEEDED on test 3 | def gcd(a, b):
while b:
a, b = b, a % b
return a
def compute_dp(N):
dp = [0] * N
for i in range(1, N):
moves = set()
for j in range(1, i + 1):
if gcd(i, j) == 1:
moves.add(dp[i - j])
mex = 0
while mex in moves:
... | 2004E | wrong_submission | hard |
276,672,572 | Java 21 | WRONG_ANSWER on test 3 | import java.io.*;
import java.util.StringTokenizer;
public class E {
String filename = null;
InputReader sc;
int MAX = (int)1e7 + 2;
int[] nb = new int[MAX + 1];
void precompute() {
nb[0] = 0;
nb[1] = 1;
int mex = 2;
for (int i = 3; i < MAX; i += 2) {
... | 2004E | wrong_submission | hard |
276,716,751 | Java 21 | WRONG_ANSWER on test 3 | import java.util.*;
// sprague grundy theorem
// if xor of grundy values of all elements is not zero then alice (first chance) wins.
// grundy value of 1 is 1.
// grundy value of a number is MEX (Minimum Excludant or smallest non-negative integer not present) of greedy values of those elements where we could reach fr... | 2004E | wrong_submission | hard |
278,816,205 | C++20 (GCC 13-64) | OK | /**
* author: tourist
* created: 30.08.2024 08:21:04
**/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
template <typename T>
class graph {
public:
struct edge {
int from;
int to;
T cost;
};
vector<edge> edges;
... | 2006E | right_submission | none |
278,815,039 | C++20 (GCC 13-64) | OK | #include <bits/stdc++.h>
using i64 = long long;
struct HLD {
int n;
std::vector<int> siz, top, dep, parent, in, out, seq;
std::vector<std::vector<int>> adj;
int cur;
HLD() {}
HLD(int n) {
init(n);
}
void init(int n) {
this->n = n;
siz.resize(n);
top... | 2006E | right_submission | none |
281,272,581 | C++17 (GCC 7-32) | OK | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 500000
#define LN 18 /* LN = floor(log2(N)) */
#define INF 0x3f3f3f3f
int min(int a, int b) { return a < b ? a : b; }
int *ej[N], eo[N];
void append(int i, int j) {
int o = eo[i]++;
if (o >= 2 && (o & o - 1) == 0)
ej[i] = (int *) realloc... | 2006E | right_submission | none |
280,543,367 | C++17 (GCC 7-32) | WRONG_ANSWER on test 2 | #include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define fast ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
typedef long long ll;
typedef long double ld;
using namespace std;
const int MAX_N = 5e5 + 10;
const int LOG = 25;
vector<int> G[MAX_N];
int par[LOG][MAX_N];
int dep[... | 2006E | wrong_submission | easy |
278,928,841 | C++23 (GCC 14-64, msys2) | WRONG_ANSWER on test 2 | #include <bits/stdc++.h>
using namespace std;
const int N = 510000;
const int LOGN = 20;
int jmp[N][LOGN], dep[N], d[N], p[N], sub[N];
vector<pair<int, int>> cent[N];
multiset<int> dists[N];
bool bad, used[N];
vector<int> g[N];
void dfs(int v, int p = -1) {
dep[v] = (p == -1 ? 0 : dep[p] + 1);
jmp[v][0] = (p ... | 2006E | wrong_submission | easy |
278,833,556 | C++17 (GCC 7-32) | WRONG_ANSWER on test 2 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
#define ls k << 1
#define rs k << 1 | 1
struct segtree
{
struct segnode
{
int l, r;
int lz, mn;
}t[maxn << 2];
inline void pushup(in... | 2006E | wrong_submission | easy |
281,710,910 | Python 3 | TIME_LIMIT_EXCEEDED on test 3 | import heapq
par = []
depth = []
def build(u, p):
par[u][0] = p
i = 0
while par[u][i]:
par[u][i + 1] = par[par[u][i]][i]
i += 1
depth[u] = depth[p] + 1
def lca(u, v):
d = depth[u] + depth[v]
if depth[v] > depth[u]:
u, v = v, u
for i in range(19, -1, -1):
i... | 2006E | wrong_submission | easy |
278,851,862 | C++20 (GCC 13-64) | WRONG_ANSWER on test 3 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
class Tree {
public:
int n; // number of nodes
vector<vector<int>> adj; // adjacency list
vector<int> depth, parent, subtree_size;
vect... | 2006E | wrong_submission | easy |
278,842,540 | C++23 (GCC 14-64, msys2) | WRONG_ANSWER on test 3 | #include <bits/stdc++.h>
int T,N,dg[500009],p[500009],anc[500009][19],hd[500009],to[1000009],nxt[1000009],k,vv[500009],
d[500009],as[500009][22],dep[500009],r[500009];
void l(int u,int v) {
to[++k]=v;nxt[k]=hd[u];hd[u]=k;
}
inline int lca(int a,int b) {
if(dep[a]<dep[b]) std::swap(a,b);
for(int i=18;i>=0;i--)
... | 2006E | wrong_submission | easy |
280,284,222 | C++20 (GCC 13-64) | WRONG_ANSWER on test 3 | #include<map>
#include<set>
#include<ctime>
#include<cmath>
#include<queue>
#include<bitset>
#include<cstdio>
#include<vector>
#include<random>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
#define I ll
#define her1 20081214
#define IV void
#define ... | 2006E | wrong_submission | easy |
278,841,125 | C++23 (GCC 14-64, msys2) | WRONG_ANSWER on test 3 | #include <bits/stdc++.h>
int T,N,dg[500009],p[500009],anc[500009][19],hd[500009],to[1000009],nxt[1000009],k,vv[500009],
d[500009],as[500009][22],dep[500009],r[500009];
void l(int u,int v) {
to[++k]=v;nxt[k]=hd[u];hd[u]=k;
}
inline int lca(int a,int b) {
if(dep[a]<dep[b]) std::swap(a,b);
for(int i=18;i>=0;i--)
... | 2006E | wrong_submission | easy |
278,843,121 | C++20 (GCC 13-64) | TIME_LIMIT_EXCEEDED on test 6 | #include <bits/stdc++.h>
using namespace std;
// #define int long long
typedef long long ll;
typedef long double ld;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ar(x) array<int, x>
const int INF = (int) 2e9;
const int L = 20;
void solve() {
int... | 2006E | wrong_submission | medium |
278,930,416 | C++20 (GCC 13-64) | TIME_LIMIT_EXCEEDED on test 6 | //A tree without skin will surely die.
//A man without face will be alive.
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for (int i=j;i<=k;++i)
#define per(i,j,k) for (int i=j;i>=k;--i)
int const N=5e5+10;
int n,p[N],siz[N],du[N],mx,maxn[N],rt;
vector<int>a[N];
inline void dfs(int x,int fa,int dep){
... | 2006E | wrong_submission | medium |
280,183,318 | C++23 (GCC 14-64, msys2) | TIME_LIMIT_EXCEEDED on test 6 | #include<bits/stdc++.h>
using namespace std;
void dfs(int i, int depth, vector<vector<int>> &adj, vector<bool> &visited, vector<int> &order, vector<pair<int,int>> &idx){
if(visited[i]) return;
// cerr << i << " ";
visited[i] = true;
idx[i].first = order.size();
order.push_back(depth);
for(int c : adj[i]) ... | 2006E | wrong_submission | medium |
279,475,310 | C++23 (GCC 14-64, msys2) | TIME_LIMIT_EXCEEDED on test 6 | #include<bits/stdc++.h>
#define Pr pair<int,int>
#define fi first
#define nd second
#define psb push_back
using namespace std;
typedef long long LL;
inline int read(){
char ch=getchar();
while(!isdigit(ch) && ch!='-') ch=getchar();
int x=0,ff=1; if(ch=='-') ff=-1,ch=getchar();
while(isdigit(ch)) x=(x<<3) + (x<<1) +... | 2006E | wrong_submission | medium |
292,461,425 | C++20 (GCC 13-64) | WRONG_ANSWER on test 6 | // Author: YE Minghan
#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "templates/debug.h"
#else
#define dbg(...) (void)0
#define msg(...) (void)0
#endif
#define ll long long
#define endl '\n'
#define PB emplace_back
#define PPB pop_back
#define MP make_pair
#define ALL(Name) Name.begin(),Name.end()
#... | 2006E | wrong_submission | medium |
278,847,305 | C++20 (GCC 13-64) | TIME_LIMIT_EXCEEDED on test 6 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 500000
int i,j,k,n,m,t,dfn[N+50],it,fa[N+50],in[N+50],mx;
basic_string<int> v[N+50];
int dep[N+50];
struct SB{
int i,j,k,n;
int f[21][N+50];
int _get(int l,int r){
return (dfn[l]<dfn[r]?l:r);
}
void init(int nn){
n=nn;
for(i=1... | 2006E | wrong_submission | medium |
278,943,352 | C++17 (GCC 7-32) | TIME_LIMIT_EXCEEDED on test 10 | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define pb push_back
#define REP(i,b,e) for(int i=(b);i<(int)(e);++i)
#define over(x) {cout<<(x)<<endl;return;}
struct ds{
int seg[2000005],tag[2000005];
voi... | 2006E | wrong_submission | hard |
292,592,720 | C++17 (GCC 7-32) | TIME_LIMIT_EXCEEDED on test 10 | #include<bits/stdc++.h>
using namespace std;
using i64=long long;
const int N=5e5+5;
i64 n;
vector<i64>v[N];
i64 fa[N],an[N][21],dep[N],dfn[N],rev[N],tot,deg[N],ls[N];
struct STree{
i64 mn[N<<2],lazy[N<<2];
void init(i64 l,i64 r,i64 p){
mn[p]=(l==0? 0:1e18),lazy[p]=0;
if(l==r)return;
i64 m=(l+r)>>1;
init(l,m,... | 2006E | wrong_submission | hard |
281,711,081 | PyPy 3-64 | TIME_LIMIT_EXCEEDED on test 11 | import heapq
par = []
depth = []
def build(u, p):
par[u][0] = p
i = 0
while par[u][i]:
par[u][i + 1] = par[par[u][i]][i]
i += 1
depth[u] = depth[p] + 1
def lca(u, v):
d = depth[u] + depth[v]
if depth[v] > depth[u]:
u, v = v, u
for i in range(19, -1, -1):
i... | 2006E | wrong_submission | hard |
278,846,141 | C++20 (GCC 13-64) | TIME_LIMIT_EXCEEDED on test 11 | #include "bits/stdc++.h"
using namespace std;
#define all(x) x.begin(),x.end()
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << " " << p.second; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename... | 2006E | wrong_submission | hard |
279,340,157 | C++20 (GCC 13-64) | TIME_LIMIT_EXCEEDED on test 11 | #include<bits/stdc++.h>
#define Pr pair<int,int>
#define fi first
#define nd second
#define psb push_back
using namespace std;
typedef long long LL;
inline int read(){
char ch=getchar();
while(!isdigit(ch) && ch!='-') ch=getchar();
int x=0,ff=1; if(ch=='-') ff=-1,ch=getchar();
while(isdigit(ch)) x=(x<<3) + (x<<1) +... | 2006E | wrong_submission | hard |
279,473,857 | C++23 (GCC 14-64, msys2) | TIME_LIMIT_EXCEEDED on test 11 | #include<bits/stdc++.h>
#define Pr pair<int,int>
#define fi first
#define nd second
#define psb push_back
using namespace std;
typedef long long LL;
inline int read(){
char ch=getchar();
while(!isdigit(ch) && ch!='-') ch=getchar();
int x=0,ff=1; if(ch=='-') ff=-1,ch=getchar();
while(isdigit(ch)) x=(x<<3) + (x<<1) +... | 2006E | wrong_submission | hard |
283,584,804 | C++20 (GCC 13-64) | OK | #include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
struct DSU {
std::vector<int> f, siz;
DSU() {}
DSU(int n) {
init(n);
}
void init(int n) {
f.resize(n);
std::iota(f.begin(), f.end(), 0);
siz.assign(n, 1);... | 2020D | right_submission | none |
283,565,809 | C++20 (GCC 13-64) | OK | /**
* author: tourist
* created: 29.09.2024 08:41:30
**/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
class dsu {
public:
vector<int> p;
int n;
dsu(int _n) : n(_n) {
p.resize(n);
iota(p.begin(), p.end(), 0);
}
... | 2020D | right_submission | none |
284,516,912 | C++20 (GCC 13-64) | OK | /*Nikhil*/
#include <bits/stdc++.h>
using namespace std;
/**************************************MACROS**************************************/
#define int long long
#define ld long double
#define all(x) (x).begin(), (x).end()
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define endl '\n'
#define u_m unorder... | 2020D | right_submission | none |
283,861,750 | C++17 (GCC 7-32) | TIME_LIMIT_EXCEEDED on test 2 | // Online C++ compiler to run C++ program online
#include <iostream>
#include <cstring>
using namespace std;
long long val;
long parent[200002],dp[200002][11],sizes[200002],ind[200002][11];
long par(long k){
if(parent[k]==k)
return k;
return parent[k]=par(parent[k]);
}
void unionFind(long a,long b... | 2020D | wrong_submission | easy |
285,190,316 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include<bits/stdc++.h>
#define endl "\n"
using namespace std;
#define int long long
#define mod 1000000007
class DSU{
public:
int n, *par, *rank;
public:
DSU(int n){
this->n=n;
par=(int*)malloc(sizeof(int)*(n+1));
rank=(int*)malloc(sizeof(int)*(n+1));
memset(rank, 0, sizeof(rank));
for(int i=1;i<=n;i... | 2020D | wrong_submission | easy |
283,666,642 | C++17 (GCC 7-32) | WRONG_ANSWER on test 2 | //libraries
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//namespaces
using namespace std;
using namespace __gnu_pbds;
using namespace chrono;
//utility variables
long long int _debug = 0, _nested = 0, _t = 1, _random_setup=0;
time_point <high_re... | 2020D | wrong_submission | easy |
284,310,017 | PyPy 3-64 | WRONG_ANSWER on test 2 | t = int(input())
for _ in range(t):
n, m = map(int, input().split())
qrs = []
for _ in range(m):
a, d, k = map(int, input().split())
qrs.append((a, d, k))
tab = [[0]*11 for _ in range(n + 1)]
for i in range(m):
a, d, k = qrs[i]
tab[a][d] += 1
tab[a + k * ... | 2020D | wrong_submission | easy |
283,648,986 | Python 3 | WRONG_ANSWER on test 2 | t=int(input())
for _ in range(t):
n,m = map(int,input().split(" "))
lista = [i for i in range(1,n+1)]
arch=0
for __ in range(m):
a,d,k = map(int,input().split(" "))
allista = [a+i*d for i in range(k+1)]
benne=True
for v in allista:
if v in lista:
... | 2020D | wrong_submission | easy |
283,630,385 | PyPy 3-64 | WRONG_ANSWER on test 2 | for _ in range(int(input())):
n, m = map(int, input().split())
queries = [[] for i in range(11)]
for _ in range(m):
a, d, k = map(int, input().split())
queries[d].append([a, k])
for i in range(11):
queries[i].sort()
nodes = [False for i in range(n+1)]
ans = 0
for i ... | 2020D | wrong_submission | easy |
284,185,186 | Java 21 | RUNTIME_ERROR on test 2 | import javax.print.attribute.HashPrintServiceAttributeSet;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.*;
public class Main {
public static void main(String[] args)... | 2020D | wrong_submission | easy |
283,639,731 | Java 21 | WRONG_ANSWER on test 2 | import java.io.*;
import java.util.*;
public class D {
static class DSU {
DSU(int n) {
init(n);
}
private int[] p, sz;
void init(int n) {
p = new int[n];
sz = new int[n];
for (int i = 0; i < n; i++) {
p[i] = i;... | 2020D | wrong_submission | easy |
284,482,787 | C++17 (GCC 7-32) | WRONG_ANSWER on test 3 | #include<iostream>
#include<set>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<unordered_map>
#include<queue>
using namespace std;
vector<int> dsu,ranked;
int parent(int root){
if(dsu[root]==root)return root;
return dsu[root]= parent(dsu[root]);
}
void unite(int c1, int c2 ){
... | 2020D | wrong_submission | medium |
284,975,165 | C++17 (GCC 7-32) | WRONG_ANSWER on test 3 | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define print(x) for(auto it:(x)) cout<<it<<" "; cout<<endl;
#define printp(x) for(auto it:(x)) cout<<it.first<<" "<<it.second<<endl;
typedef vector<int> vi;
typedef... | 2020D | wrong_submission | medium |
291,379,123 | PyPy 3-64 | WRONG_ANSWER on test 3 | import sys
def find(u):
if un[u] != u:
un[u] = find(un[u])
return un[u]
def union(u, v):
ru = find(u)
rv = find(v)
if ru == rv:
return 0
un[rv] = ru
return 1
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n, m = map(int, input().split())
grp = [[[] for _ in range(10)] for _ in range(... | 2020D | wrong_submission | medium |
285,402,146 | PyPy 3-64 | RUNTIME_ERROR on test 3 | from types import GeneratorType
def bootstrap(f, stack=[]):
def wrappedfunc(*args, **kwargs):
if stack:
return f(*args, **kwargs)
else:
to = f(*args, **kwargs)
while True:
if type(to) is GeneratorType:
stack.append(to)
... | 2020D | wrong_submission | medium |
288,346,780 | Java 21 | WRONG_ANSWER on test 3 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class connectTheDots {
static class DisJointSet {
int[] parent;
int[] rank;
int N;
int numOfComp = 0;
DisJointSet(int n) {
this.parent = new int[n];
... | 2020D | wrong_submission | medium |
283,635,925 | Java 8 | WRONG_ANSWER on test 3 | /*
https://codeforces.com/contest/2020/problem/D
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
public class ConnectTheDots {
public static void mai... | 2020D | wrong_submission | medium |
293,856,178 | C++20 (GCC 13-64) | TIME_LIMIT_EXCEEDED on test 7 | #include <iostream>
#include <vector>
using namespace std;
class UnionFind {
public:
vector<int> parent;
vector<int> rank;
int count;
UnionFind(int size) {
parent.resize(size);
rank.resize(size, 0);
for (int i = 0; i < size; ++i) {
parent[i] = i;
}
... | 2020D | wrong_submission | hard |
294,478,500 | C++20 (GCC 13-64) | TIME_LIMIT_EXCEEDED on test 7 | #include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
class DSU {
public:
vector<int> parent;
vector<int> rank;
DSU(int n) {
parent.resize(n);
rank.resize(n, 0);
for (int i = 0; i < n; ++i) {
parent[i] = i;
}
}
int fin... | 2020D | wrong_submission | hard |
283,627,998 | PyPy 3-64 | TIME_LIMIT_EXCEEDED on test 7 | class DSU:
def __init__(self, n):
self.parents = list(range(n))
self.sizes = [1] * n
def find(self, node):
while self.parents[node] != node:
node = self.parents[node]
return node
def union(self, a, b):
root_a = self.find(a)
root_b = self.find(b... | 2020D | wrong_submission | hard |
283,616,310 | Python 3 | TIME_LIMIT_EXCEEDED on test 7 | class UnionFind:
def __init__(self, n):
self.parent = list(range(n))
self.rank = [1] * n
def find(self, x):
if self.parent[x] != x:
self.parent[x] = self.find(self.parent[x]) # Path compression
return self.parent[x]
def union(self, x, y):
rootX = self... | 2020D | wrong_submission | hard |
283,712,003 | Java 21 | TIME_LIMIT_EXCEEDED on test 7 | import java.io.*;
import java.util.*;
public class D_Connect_the_Dots {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine().trim()); // Number of test cases
w... | 2020D | wrong_submission | hard |
283,618,069 | Java 21 | TIME_LIMIT_EXCEEDED on test 7 | import java.util.HashMap;
import java.util.Scanner;
public class D_Connect_the_Dots {
public static class DisjointSet {
HashMap<Integer, Integer> parent;
HashMap<Integer, Integer> size;
int count ;
DisjointSet(int n) {
parent = new HashMap<>();
size = ne... | 2020D | wrong_submission | hard |
266,078,047 | C++20 (GCC 13-64) | OK | #include <bits/stdc++.h>
using i64 = long long;
void solve() {
int n, c;
std::cin >> n >> c;
std::vector<int> a(n);
for (int i = 0; i < n; i++) {
std::cin >> a[i];
}
a[0] += c;
int t = std::max_element(a.begin(), a.end()) - a.begin();
i64 sum = 0;
for (int i = 0... | 1978D | right_submission | none |
277,171,450 | C++20 (GCC 13-64) | OK | #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 ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using ll=long long;
#define int ll
#define vi vector<int>
#define pi ... | 1978D | right_submission | none |
266,034,235 | C++17 (GCC 7-32) | OK | #include <bits/stdc++.h>
#define ll long long int
#define di(a) cout<<a<<endl;
#define ret(a) {di(a); return;}
using namespace std;
void sol(){
ll n,c; cin>>n>>c;
ll a[n];
for(int i=0;i<n;i++) cin>>a[i];
vector<ll> ans(n);
ll mx=*max_element(a,a+n);
int j;
for(int i=0;i<n;i++){
if(a[i]==mx){
j=i;
br... | 1978D | right_submission | none |
289,936,998 | C++17 (GCC 7-32) | WRONG_ANSWER on test 2 | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ppb pop_back
#define f first
#define int long long int
#define sec second
#define MOD 1e9+7
#define vi vector<int>
#define pii pair<int, int>
#define MOD1 1000000009
#define MOD2 998244353
#define PI 3.141592653589793238462
#define set_bits __bu... | 1978D | wrong_submission | easy |
297,607,230 | C++17 (GCC 7-32) | WRONG_ANSWER on test 2 | #include "bits/stdc++.h"
using namespace std;
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
#define dbg(x) cout << #x << '=' << x << endl;
#define int long long
#define inc(v) sort(v.begin... | 1978D | wrong_submission | easy |
266,067,619 | C++17 (GCC 7-32) | WRONG_ANSWER on test 2 | #include <bits/stdc++.h>
using namespace std;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define int long long
#define double long double
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define all(... | 1978D | wrong_submission | easy |
266,070,642 | PyPy 3-64 | WRONG_ANSWER on test 2 | def ii():
return int(input())
def I():
return input()
def lmii():
return list(map(int, input().split()))
def mii():
return map(int, input().split())
def lmsi():
return list(map(str, input().split()))
# import copy
import math
# M=1e9+7
# import sys
mod = 10**9 + 7
M = 998244353... | 1978D | wrong_submission | easy |
266,212,643 | Python 3 | RUNTIME_ERROR on test 2 | def solve():
n, c = map(int, input().split())
a = list(map(int,input().split()))
if n == 1:
print(0)
return
ans = []
b = []
for i in range(n):
if a[i] == 0: continue
b.append(a[i])
ii = a.index(max(a))
w = max(a)
if min(b)+c >= w:
ii = a.index(... | 1978D | wrong_submission | easy |
283,378,564 | PyPy 3-64 | WRONG_ANSWER on test 2 | import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self... | 1978D | wrong_submission | easy |
266,787,570 | Java 8 | WRONG_ANSWER on test 2 | import java.util.*;
public class ProblemD {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
long c = sc.nextLong();
long arr[] = new long[n];
for(i... | 1978D | wrong_submission | easy |
266,465,818 | Java 21 | WRONG_ANSWER on test 2 | import java.util.*;
import java.awt.List;
import java.io.*;
public class Vikash_45{
static FastScanner sc = new FastScanner();
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int t = sc.nextInt();
while(t-->0) {
vk45();
out.flush();
}
ou... | 1978D | wrong_submission | easy |
266,365,628 | C++17 (GCC 7-32) | WRONG_ANSWER on test 2 | #include <bits/stdc++.h>
using namespace std;
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int... | 1978D | wrong_submission | medium |
292,895,058 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include<bits/stdc++.h>
#define endl '\n'
#define ll long long
#define int ll
using namespace std;
constexpr int N=2e5+7;
constexpr int M=2e3+7;
int n,c;
int a[N],f[N][20];;
int ans[N];
int presum[N];
int sufmax[N];
int query(int l,int r)
{
int len=r-l+1;
int k=log(len)/log(2);
int res=max(f[l][k],f[r-(1<<k)+1][k]);... | 1978D | wrong_submission | medium |
266,796,346 | PyPy 3-64 | WRONG_ANSWER on test 2 | import bisect
from collections import Counter
for _ in range(int(input())):
n, c = map(int, input().split())
a = list(map(int, input().split()))
ans = []
a_sort = a.copy()
a_sort.sort()
a_sort_pre = [0]
for i in range(n):
a_sort_pre.append(a_sort_pre[i - 1] + a[i])
cc = Counter... | 1978D | wrong_submission | medium |
266,011,409 | PyPy 3-64 | WRONG_ANSWER on test 2 | import sys
from itertools import accumulate
# region fastio
input = lambda: sys.stdin.readline().rstrip()
sint = lambda: int(input())
mint = lambda: map(int, input().split())
ints = lambda: list(map(int, input().split()))
# endregion fastio
# MOD = 998_244_353
# MOD = 10 ** 9 + 7
# DIR4 = ((-1, 0), (0, 1), (1, 0), ... | 1978D | wrong_submission | medium |
287,767,125 | Java 21 | WRONG_ANSWER on test 2 | import java.util.*;
public class Elections {
public static void main(String[] args) {
int i = 0;
List<String> ll = new ArrayList<>();
Scanner sc = new Scanner(System.in);
while (true) {
if (i == 0) {
i = Integer.valueOf(sc.nextLine()) * 2;
} ... | 1978D | wrong_submission | medium |
266,171,146 | Java 21 | WRONG_ANSWER on test 2 | // package problems;
import java.util.*;
public class CommonTemplate {
static class Pair {
// Pair attributes
public long index;
public long value;
// Constructor to initialize pair
public Pair(long index, long value)
{
// This keyword refers to... | 1978D | wrong_submission | medium |
266,777,565 | Python 3 | WRONG_ANSWER on test 2 | t = int(input())
while(t):
n, c = map(int, input().split())
a = list(map(int, input().split()[:n]))
if(n == 1):
print(0)
elif(n == 2):
if(a[1] > a[0] + c):
print(*[1, 0])
else:
print(*[0, 1])
else:
res = []
max_val = max(a)
... | 1978D | wrong_submission | hard |
266,022,665 | PyPy 3-64 | WRONG_ANSWER on test 2 | import sys
from itertools import accumulate
# region fastio
input = lambda: sys.stdin.readline().rstrip()
sint = lambda: int(input())
mint = lambda: map(int, input().split())
ints = lambda: list(map(int, input().split()))
# endregion fastio
# MOD = 998_244_353
# MOD = 10 ** 9 + 7
# DIR4 = ((-1, 0), (0, 1), (1, 0), ... | 1978D | wrong_submission | hard |
266,003,679 | Java 8 | WRONG_ANSWER on test 2 | import java.util.*;
import java.io.*;
public class Main {
static PrintWriter pw = new PrintWriter(System.out);
static Scanner sc = new Scanner(System.in);
public static void solve() throws IOException {
int n = sc.nextInt(), c = sc.nextInt();
if(n == 200000){
while (true){
... | 1978D | wrong_submission | hard |
266,046,174 | Java 21 | RUNTIME_ERROR on test 2 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class b2
{
static long MOD = 998244353;
public static void main (String[] args) throws IOException {
FastReader sc = new FastReader();
int t = sc.nextInt();
loop: f... | 1978D | wrong_submission | hard |
272,239,569 | C++20 (GCC 13-64) | WRONG_ANSWER on test 4 | #include <bits/stdc++.h>
using namespace std;
#define Paddi ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
const int N = 5e5 + 10;
const int LOG = 20;
int s[N];
int pre[N];
int mapre[N];
int masuf[N];
int n, c;
void init()
{
for (int i = 0; i <= n + 5; i++)
s[i] = 0, pre[i] = 0, mapre[i] = 0, masuf[i]... | 1978D | wrong_submission | hard |
266,806,817 | C++17 (GCC 7-32) | WRONG_ANSWER on test 4 | #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 3e5;
const int M = 25;
const int INF = 0x3f3f3f3f;
int n, m, ans ,_;
int w[N] ,f[N];
bool cmp ( int x ,int y){ return x>y;}
int main() {
ios_base::sync_with_stdio(0),cin.tie(0);
cin>>_;
w... | 1978D | wrong_submission | hard |
290,739,214 | C++23 (GCC 14-64, msys2) | OK | #include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
constexpr i64 inf = 1E18;
void solve() {
int n, m, V;
std::cin >> n >> m >> V;
std::vector<i64> c(n);
for (int i = 0; i < n; i++) {
std::cin >> c[i];
... | 2029G | right_submission | none |
290,834,986 | C++23 (GCC 14-64, msys2) | OK | #include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define rz resize
#define Siz(a) (int)(a.size())
#define MP make_pair
#define MT make_tuple
#define IT iterator
#define fi first
#define se second
#define For(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#defi... | 2029G | right_submission | none |
290,767,076 | C++20 (GCC 13-64) | OK | #include<stdio.h>
#include<algorithm>
typedef long long ll;
int c[200005];
int a[200005];
ll _c[6015];
int _a[6015];
int stk[6015];
ll dp[6015][3015];
ll aux[3015][6015];
ll ans[6015];
inline void solve() {
int n,m,v;
scanf("%d%d%d",&n,&m,&v),++v;
for(int i=1;i<=n;i++) {
scanf("%d",c+i);
}
s... | 2029G | right_submission | none |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.