source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include<bits/stdc++.h> using namespace std; #define int long long template<typename T> void read(T &x) { x=0;int f=1; char c=getchar(); for(;!isdigit(c);c=getchar()) if(c=='-') f=-1; for(;isdigit(c);c=getchar()) x=x*10+c-'0'; x=x*f; } const int N=1000020; int n,d[N],vis[N],cnt=0,ans=0,s1,s2,s3,s4,s5; vector<int>g...
C++
e4dc319588cc8eca6a5c3d824e504c22
431222c7d412ee2bb307836a37982b29
2,800
PASSED
// Fresh Peach Heart Shower #include <bits/stdc++.h> #define reg #define ALL(x) (x).begin(),(x).end() #define mem(x,y) memset(x,y,sizeof x) #define sz(x) (int)(x).size() #define ln putchar('\n') #define lsp putchar(32) #define pb push_back #define MP std::make_pair #define MT std::make_tuple #ifdef _LOCAL_ #define dbg(...
C++
e4dc319588cc8eca6a5c3d824e504c22
c947e024a77bad6431c0735caa4d7856
2,800
PASSED
// Fresh Peach Heart Shower #include <bits/stdc++.h> #define reg #define ALL(x) (x).begin(),(x).end() #define mem(x,y) memset(x,y,sizeof x) #define sz(x) (int)(x).size() #define ln putchar('\n') #define lsp putchar(32) #define pb push_back #define MP std::make_pair #define MT std::make_tuple #ifdef _LOCAL_ ...
C++
e4dc319588cc8eca6a5c3d824e504c22
9dacdbd286f74b4c1cc6672a541bed20
2,800
PASSED
#include <bits/stdc++.h> #define maxn 500005 using namespace std; const int inf = 0x3f3f3f3f; inline int read() { int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } ...
C++
e4dc319588cc8eca6a5c3d824e504c22
b229f4d85d9176f782e3ae8a72e4ba01
2,800
PASSED
#include<algorithm> #include<cstdio> #define MaxN 200500 using namespace std; struct Data{int u,v;}ans[MaxN]; int tot,p[MaxN]; void qswap(int u,int v) {swap(p[u],p[v]);ans[++tot]=(Data){u,v};} void mdf(int u,int v) { qswap(u,v); while(p[u]!=v)qswap(u,p[u]); while(p[v]!=u)qswap(v,p[v]); qswap(u,v); ...
C++
e4dc319588cc8eca6a5c3d824e504c22
ed88e7ff96c7569f8a8cfecedf480ff0
2,800
PASSED
#include<cstdio> #include<cstring> #include<vector> #include<algorithm> using namespace std; const int N=2e5+5; int Head[N],Ver[N],Nxt[N],cnt_edge; int ansl[N],ansr[N],cntans; int n; int dfn[N],low[N],clk,col[N],cnt_col,st[N],top,len[N],id[N]; vector<int>poi[N]; vector<int>hlp; inline int Read(){ char ch; int f=1; w...
C++
e4dc319588cc8eca6a5c3d824e504c22
813c386c0a64f4e208ff2df16663e7ea
2,800
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<vector> #define N 200010 using namespace std; int n,a[N]; bool vis[N]; vector<pair<int,int>> v; /*void cswap(int i,int j){ swap(arr[i],arr[j]); arr[i]=-arr[i],arr[j]=-arr[j]; ans.pub(ii(i,j)); }*/ void convert(int i,int...
C++
e4dc319588cc8eca6a5c3d824e504c22
18cd3a7ca6b7361129503375fbd5c9b7
2,800
PASSED
#include<bits/stdc++.h> #define int long long #define rep(i,j,k) for(int i=(j);i<=(k);++i) #define drp(i,j,k) for(int i=(j);i>=(k);--i) inline int read() { int x=0,f=0;char ch; while(!isdigit(ch=getchar())) f|=ch=='-'; while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48),ch=getchar(); return f?-x:x; } //---------...
C++
e4dc319588cc8eca6a5c3d824e504c22
0a4b9b4121a03be2af3a385d2278dc7b
2,800
PASSED
#include <bits/stdc++.h> using namespace std; class YueTree { private: //divide n nodes into several (intervals) blocks of size k(last block might be smaller) int n, k; //p[v]: parent of v; j[v]: v's first ancestor whose p[v] is not in the same block as v //unlocked[i]: the count of nodes in block[i] ...
C++
d2ad63f4559e03fdad044f489040c183
7e7137cd7c2bf1e6a7261773a58fa9e4
3,400
PASSED
#include <bits/stdc++.h> using namespace std; class YueTree { private: int n, k; vector<int> p, j, unlocked, tag; inline int block_id(int v) { return (v + k - 1) / k; } inline int block_st(int i) { return max(0, (i - 1) * k + 1); } inline int block_ed(int i) { return min(i * k, n - 1); } inline ...
C++
d2ad63f4559e03fdad044f489040c183
7053bb0ad74c951f6859a44a3d0462ea
3,400
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; inline int getint() { int f = 1, x = 0; char ch; do { ch = getchar(); if (ch == '-') f = -1; } while (ch < '0' || ch > '9'); do { x = x * 10 + ch - '0'; ch = getchar(); } while (ch >= '0' && ch <= '...
C++
d2ad63f4559e03fdad044f489040c183
d108c45ae8c2df2ec75b0f3feed8856a
3,400
PASSED
#include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #define ll long long using namespace std; inline int read() { int f = 1, x = 0; char ch; do { ch = getchar(); if (ch == '-') f = -1; } while (ch < '0' || ch > '9'); do { x = x * 10 + ch - '0'; ...
C++
d2ad63f4559e03fdad044f489040c183
faa9f1d8b528f2d380152c0a5cea4c75
3,400
PASSED
#include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #define ll long long using namespace std; inline int read() { int f = 1, x = 0; char ch; do { ch = getchar(); if (ch == '-') f = -1; } while (ch < '0' || ch > '9'); do { x = x * 10 + ch - '0'; ...
C++
d2ad63f4559e03fdad044f489040c183
947094f816e58c45d2111257763916e5
3,400
PASSED
#include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #define ll long long using namespace std; inline int read() { int f = 1, x = 0; char ch; do { ch = getchar(); if (ch == '-') f = -1; } while (ch < '0' || ch > '9'); do { x = x * 10 + ch - '0'; ...
C++
d2ad63f4559e03fdad044f489040c183
b02771d2af6dd5945e3cf47895f2391a
3,400
PASSED
#include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #define ll long long using namespace std; inline int read() { int f = 1, x = 0; char ch; do { ch = getchar(); if (ch == '-') f = -1; } while (ch < '0' || ch > '9'); do { x = x * 10 + ch - '0'; ...
C++
d2ad63f4559e03fdad044f489040c183
7fd65d67da3ff8748381f58cd9777d6d
3,400
PASSED
#include <bits/stdc++.h> #define ll long long #define sz(x) ((int)x.size()) using namespace std; const bool DB = 0; const int N = 300005, B = 300; int n, q, a[N], b[N], c[N / B], d[N / B]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> q; a[1] = -B; for(int i = 2; i <= n; ++i) { cin...
C++
d2ad63f4559e03fdad044f489040c183
36613c66808f4705f79cf13db7b8ddfb
3,400
PASSED
#include<bits/stdc++.h> #define ll int #define f first #define s second #define pb push_back using namespace std; ll n,q,p[100005],a[100005],raod[100005]; ll k[100005],was[100005],da[100005],uk[100005],sq,zog; ll f[100005]; ll saw(ll x){ return x / sq * sq; } void upd(ll l,ll x){ a[l] = a[l] - (da[...
C++
d2ad63f4559e03fdad044f489040c183
672739837cb97110e67d2ec89a23733b
3,400
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <map> #include <set> #include <cstdlib> #include <cmath> #include <deque> using namespace std; #define pii pair<int,int> #define mp make_pair const int N = 5e5 + 10; #define int long long int read() { int x = 0, ...
C++
d2ad63f4559e03fdad044f489040c183
c9d803b90b833587bc566aa03a769b2b
3,400
PASSED
#include <bits/stdc++.h> const int red = 0; const int blue = 1; const int green = 2; const long long inf = 1e16; typedef std::pair<long long, long long> ii; typedef std::pair<long long, ii> iii; struct animal { long a, b, c; int id, pos, color, redHere; }; long long moves = 0; std::vector<ani...
C++
6bec3bcf1ac28b93a0b302c11a63ca37
ce78c31d5523170783e4f96958dfad49
3,500
PASSED
#include <bits/stdc++.h> using namespace std; const int RED = 0, BLUE = 1, GREEN = 2; const long long inf = 1e16; typedef pair<long long, long long> ii; typedef pair<long long, ii> iii; long long n; struct animal{ int a, b, c, id, pos, colour, redHere; }; vector<animal> belt; vector<animal> arr; vector<ii...
C++
6bec3bcf1ac28b93a0b302c11a63ca37
f44dabcb4414a7d3df664a679c84f198
3,500
PASSED
#include<cstdio> #include<cctype> #include<vector> #include<cstdlib> #include<algorithm> using std::swap; #define mp std::make_pair #define maxn 6666 template<class T> inline T read(){ T r=0,f=0; char c; while(!isdigit(c=getchar()))f|=(c=='-'); while(isdigit(c))r=(r<<1)+(r<<3)+(c^...
C++
6bec3bcf1ac28b93a0b302c11a63ca37
9a12c6ff94db88cda45c37f6becf5b32
3,500
PASSED
#include<cstdio> #include<cctype> #include<vector> #include<cstdlib> #include<algorithm> using std::swap; #define mp std::make_pair #define maxn 6666 template<class T> inline T read(){ T r=0,f=0; char c; while(!isdigit(c=getchar()))f|=(c=='-'); while(isdigit(c))r=(r<<1)+(r<<3)+(c^...
C++
6bec3bcf1ac28b93a0b302c11a63ca37
c20857e352a7f630a6b374eec2193cb1
3,500
PASSED
//just for test #include <bits/stdc++.h> using namespace std; const int RED = 0, BLUE = 1, GREEN = 2; const long long inf = 1e16; typedef pair<long long, long long> ii; typedef pair<long long, ii> iii; long long n; struct animal{ int a, b, c, id, pos, colour, redHere; }; vector<animal> belt; vector<animal...
C++
6bec3bcf1ac28b93a0b302c11a63ca37
fe5126044e76460a8af36c0588ba98d1
3,500
PASSED
#include <bits/stdc++.h> using namespace std; const int RED = 0, BLUE = 1, GREEN = 2; const long long inf = 1e16; typedef pair<long long, long long> ii; typedef pair<long long, ii> iii; long long n; struct animal{ int a, b, c, id, pos, colour, redHere; }; vector<animal> belt; vector<animal> arr; vector<...
C++
6bec3bcf1ac28b93a0b302c11a63ca37
5cb408192b9fa5778ea56932b2bf9e16
3,500
PASSED
#include<bits/stdc++.h> namespace my_std{ using namespace std; #define pii pair<int,int> #define fir first #define sec second #define MP make_pair #define rep(i,x,y) for (int i=(x);i<=(y);i++) #define drep(i,x,y) for (int i=(x);i>=(y);i--) #define go(x) for (int i=head[x];i;i=edge[i].nxt) #define tem...
C++
6bec3bcf1ac28b93a0b302c11a63ca37
53918a6f373d9f693328d609e59b2746
3,500
PASSED
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i <= b; i++) #define per(i, a, b) for (int i = a; i >= b; i--) using namespace std; typedef unsigned long long ull; typedef pair <int, int> pii; typedef long long ll; template <typename T> inline void read(T &f) { f = 0; T fu = 1; char c = g...
C++
6bec3bcf1ac28b93a0b302c11a63ca37
c399e57685ad84be52fca16142751ac0
3,500
PASSED
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i <= b; i++) #define per(i, a, b) for (int i = a; i >= b; i--) using namespace std; typedef unsigned long long ull; typedef pair <int, int> pii; typedef long long ll; template <typename T> inline void read(T &f) { f = 0; T fu = 1; char c = g...
C++
6bec3bcf1ac28b93a0b302c11a63ca37
00268f3cd34758e17bbead561136dae3
3,500
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 6005; using ll = long long; void rotate(int a[],int n,int kk) { static int b[N];for (int i = 0;i < n;i++) b[i] = a[(i + kk) % n]; for (int i = 0;i < n;i++) a[i] = b[i]; } int a[N],b[N],c[N],n,p[N],p2[N * 2],q[N * 2];ll t;int gap[N]; int main ...
C++
6bec3bcf1ac28b93a0b302c11a63ca37
517c1a2f9a61e4b9f562fd9aaf9a0871
3,500
PASSED
#include <bits/stdc++.h> #define ll long long #define bcnt(x) (qzh[b[r] - 1][x] - qzh[b[l]][x]) #define st first #define nd second #define lb(x) (x & (-x)) using namespace std; int read() { int x = 0; char c = 0; while(c < '0' || '9' < c) c = getchar(); while('0' <= c && c <= '9') x = x * 10 + c - '0', c = get...
C++
b2656158c55bb801806c079f29e4d4c1
e3babe7d147539cfa5fec24e8167f8ad
2,600
PASSED
#include <bits/stdc++.h> #define ll long long #define bcnt(x) (qzh[b[r] - 1][x] - qzh[b[l]][x]) #define st first #define nd second #define lb(x) (x & (-x)) using namespace std; int read() { int x = 0; char c = 0; while(c < '0' || '9' < c) c = getchar(); while('0' <= c && c <= '9') x = x * 10 + c - '0', c = get...
C++
b2656158c55bb801806c079f29e4d4c1
bdc7f2dabcf06e746d979100cccb01a8
2,600
PASSED
#include <bits/stdc++.h> #define ll long long #define bcnt(x) (qzh[b[r] - 1][x] - qzh[b[l]][x]) #define st first #define nd second #define lb(x) (x & (-x)) using namespace std; int read() { int x = 0; char c = 0; while(c < '0' || '9' < c) c = getchar(); while('0' <= c && c <= '9') x = x * 10 + c...
C++
b2656158c55bb801806c079f29e4d4c1
870afeebacd04b4745c0f69a4c8280cd
2,600
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int base1=233,base2=2011,mod1=1e9+7,mod2=1e9+9; vector<int> a[1505],b[1505]; int n,m,K,id[1505],hsh1[1505],hsh2[1505],ans[1505],lst[1505][1505],cur1[1505],cur2[1505],used[1505]; bitset<1505> can[1505]; map<pair<int,int>,vector<int> > mp; b...
C++
b2656158c55bb801806c079f29e4d4c1
3934a6b82151e772b53f6ce04b863ec8
2,600
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int base1=5497,base2=2011,mod1=957270779,mod2=1e9+9; vector<int> a[1505],b[1505]; int n,m,K,id[1505],hsh1[1505],hsh2[1505],ans[1505],lst[1505][1505],cur1[1505],cur2[1505],used[1505]; bitset<1505> can[1505]; map<pair<int,int>,vector<int> > m...
C++
b2656158c55bb801806c079f29e4d4c1
739c367538e315494ecc9d7f5c4030a6
2,600
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int base1=233,base2=2011,mod1=1e9+7,mod2=1e9+9; vector<int> a[1505],b[1505]; int n,m,K,id[1505],hsh1[1505],hsh2[1505],ans[1505],lst[1505][1505],cur1[1505],cur2[1505],used[1505]; bitset<1505> can[1505]; map<pair<int,int>,vector<int> > mp; b...
C++
b2656158c55bb801806c079f29e4d4c1
ae450d6711d42052323b26b70e58f806
2,600
PASSED
//fuck #pragma GCC optimize(2) #pragma GCC target("avx") #pragma GCC optimize("Ofast") #pragma GCC optimize("inline") #include <bits/stdc++.h> using namespace std; inline void read (int &x) { char c = getchar(); int w = 0; x = 0; for (; !isdigit(c); c = getchar()) w ^= !(c ^ 45); for (; isdigi...
C++
b2656158c55bb801806c079f29e4d4c1
bc76d2ddd74dbfb56baa34a3eafd8917
2,600
PASSED
#include<algorithm> #include<iostream> #include<cstdio> #include<vector> #include<queue> #include<map> #define vi vector<int> using namespace std; const int N=3010; int n,m; int v[N]; int A[N]; int id[N]; int deg[N]; int a[N][N]; int b[N][N]; vi e[N],ans; map <vi,vi> mp; queue <int> q; bool cmp(int x...
C++
b2656158c55bb801806c079f29e4d4c1
a32183a4d3cbd2f4834dba6110925d93
2,600
PASSED
#include<algorithm> #include<iostream> #include<cstdio> #include<vector> #include<queue> #include<map> #define vi vector<int> using namespace std; const int N=3010; int n,m; int v[N]; int A[N]; int deg[N]; int a[N][N]; int b[N][N]; vi e[N],ans; map <vi,vi> mp; queue <int> q; bool chk(int x,int y) { ...
C++
b2656158c55bb801806c079f29e4d4c1
9230ad9ac52865b8673e33961fe692df
2,600
PASSED
#include <bits/stdc++.h> using namespace std; const int N=1500; int n,m; int A[N][N],B[N][N]; bool used[N]; int main() { cin >> n >> m; for (int i=0;i<n;++i) for (int j=0;j<m;++j) scanf("%d",&A[i][j]); for (int i=0;i<n;++i) for (int j=0;j<m;++j) ...
C++
b2656158c55bb801806c079f29e4d4c1
fe6851e59b5caab5a6caf0fbbf66cd14
2,600
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 5e6 + 10 ; vector<pair<int, int>> ve[N]; vector<int>a(N); int main() { int n; scanf("%d", &n); for(int i = 1 ; i <= n ; i++) scanf("%d", &a[i]); for (int i = 1 ; i <= n; i++) { for (int j = 1 ; j <= n ; j++...
C++
704297bc97528ec27cce5f9388019e29
b97c7a5a14bdecdc70b0dccacf5e5578
1,800
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 5e6 + 10 ; vector<pair<int, int>> ve[N]; vector<int>a(N); int main() { int n; scanf("%d", &n); for(int i = 1 ; i <= n ; i++) scanf("%d", &a[i]); for (int i = 1 ; i <= n; i++) { for (int j = 1 ; j <= n ; j++...
C++
704297bc97528ec27cce5f9388019e29
3f9a34a491db5fb242f10f7218626798
1,800
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 5e6 + 10 ; vector<pair<int, int>> ve[N]; int a[N]; int main() { int n; scanf("%d", &n); for(int i = 1 ; i <= n ; i++) scanf("%d", &a[i]); for (int i = 1 ; i <= n; i++) { for (int j = 1 ; j <= n ; j++) ...
C++
704297bc97528ec27cce5f9388019e29
c6850ec653344637e5ede102bcd5fca0
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 5e6 + 10; int a[maxn]; vector<pair<int, int> > ve[maxn]; int main() { int n; scanf("%d", &n); for(int i = 1; i <= n; i ++) scanf("%d", &a[i]); for(int i = 1; i <= n; i ++) { for(int j = 1; j <= n; j ++) { ...
C++
704297bc97528ec27cce5f9388019e29
7a167cdd1f76aaf5bc7f9be6203e3d78
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mod 1000000007 #define sqr(x) (x) * (x) #define ll long long #define PRINT_CASE printf("Case %d: ", z) #define TEST_CASE(t) for (int z = 1; z <= t; z++) #define sf(a) scanf("%d", &a) #define sfl(a) scanf("%lld", &a) #define D(x) cerr <...
C++
704297bc97528ec27cce5f9388019e29
39993221b4a23253267e5de5b6f3532e
1,800
PASSED
///#pragma GCC optimize(2) #include<bits/stdc++.h> //#define int long long ///*****Sellaris*****/// //#define CLOCKS_PER_SEC ((clock_t)1000) using namespace std; inline int read(){ int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-') f=-1; ch=getchar(...
C++
704297bc97528ec27cce5f9388019e29
0d2e0105b165b0a10de1cfc7486834d6
1,800
PASSED
///#pragma GCC optimize(2) #include<bits/stdc++.h> //#define int long long ///*****Sellaris*****/// //#define CLOCKS_PER_SEC ((clock_t)1000) using namespace std; inline int read(){ int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-') f=-1; ch=getchar(...
C++
704297bc97528ec27cce5f9388019e29
80f04068df2f1de97ee3a7a5e0802356
1,800
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 2e5 + 30; int a[N]; const int M = 3e6 + 10; vector<pair<int, int>> me[M]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; } n = min(n, 1573); for (int i = 1; i <= n; ++i) { for (int j = i + 1; j <= n; ++...
C++
704297bc97528ec27cce5f9388019e29
10d79474f511b67daaacce59896a3341
1,800
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 2e5 + 30; int a[N]; const int M = 3e6 + 10; vector<pair<int, int>> me[M]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; } n = min(n, 1577); for (int i = 1; i <= n; ++i) { for (int j = i + 1; j <= n; ++...
C++
704297bc97528ec27cce5f9388019e29
b955e9067dac0bb5a656aaec7fbd9274
1,800
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 2e5 + 30; int a[N]; const int M = 3e6 + 10; vector<pair<int, int>> me[M]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; } n = min(n, 1581); for (int i = 1; i <= n; ++i) { for (int j = i + 1; j <= n; ++...
C++
704297bc97528ec27cce5f9388019e29
d0feb5a6daca148e999f0126e4f24de0
1,800
PASSED
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<algorithm> #include<queue> #include<iostream> using namespace std; const int N = 1500, Q = 10; short n, q; int a[N + 1][N + 1]; short xx, yy; bool vis[N * N + 1]; int ans[N + 1]; short dis(short x, short y) { retur...
C++
20f5ecf8b80783e44c13179c9c5f69b4
63c00a2dc78229560f34ffd87a24cfae
2,900
PASSED
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<algorithm> #include<queue> #include<iostream> using namespace std; const int N = 1500, Q = 10; short n, q; int a[N + 1][N + 1]; short xx, yy; bool vis[N * N + 1]; int ans[N + 1]; short dis(short x, short y) { retur...
C++
20f5ecf8b80783e44c13179c9c5f69b4
1452c1ef592a24491b15fadfb44c3e9c
2,900
PASSED
#include<bits/stdc++.h> #define f first #define s second //#define int long long #define pii pair<int,int> using namespace std; const int N = 1516 + 5, mod = 1e9 + 7; // ! vector<pair<int,int>> col[N][N]; int f[N * N]; main(){ #define endl "\n" ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);...
C++
20f5ecf8b80783e44c13179c9c5f69b4
654c6a6e1aa302a977d1dd59fa2aa08d
2,900
PASSED
//#pragma GCC optimize("O3") //#pragma GCC target("avx") //#pragma GCC target("avx2") //#include <bits/stdc++.h> #include <iostream> #include <vector> #include <array> using namespace std; using pii = pair<int, int>; #define all(x) (x).begin(), (x).end() #define sz(x) ((int) (x).size()) #define ff first ...
C++
20f5ecf8b80783e44c13179c9c5f69b4
6e52fbe0523dd431a61b37e6032a1dd9
2,900
PASSED
#include<vector> #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> namespace EMT{ typedef long long ll;typedef double db; #define pf printf #define F(i,a,b) for(int i=a;i<=b;i++) #define D(i,a,b) for(int i=a;i>=b;i--) inline int read(){int x=0,f=1;char ch=getchar();while(ch<...
C++
20f5ecf8b80783e44c13179c9c5f69b4
e444d62aae5026fcfdd88068c683df2c
2,900
PASSED
// KiruxaLight #define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <string> #include <set> #include <map> #include <algorithm> #include <utility> #include <cmath> #include <iomanip> #include <stack> #include <deque> #include <queue> #include <cstdio> ...
C++
20f5ecf8b80783e44c13179c9c5f69b4
d1aac7bfdcda21964f17cf4974f6025f
2,900
PASSED
// LUOGU_RID: 95186241 #include<bits/stdc++.h> #define ll long long #define ull unsigned long long #define db double #define ldb long double #define pb push_back #define mp make_pair #define pii pair<int, int> #define FR first #define SE second #define re register using namespace std; inline int read() { int x = 0;...
C++
20f5ecf8b80783e44c13179c9c5f69b4
e6eb3d9fe6c7390f8b13094d6366ba79
2,900
PASSED
#include<bits/stdc++.h> #define ll long long #define ull unsigned long long #define db double #define ldb long double #define pb push_back #define mp make_pair #define pii pair<int, int> #define FR first #define SE second #define re register using namespace std; inline int read() { int x = 0; bool op =...
C++
20f5ecf8b80783e44c13179c9c5f69b4
a0b937ecd764e4cd4f4cee8b8b013a28
2,900
PASSED
#include<bits/stdc++.h> using namespace std; int n,m,f[1511][1511],ans[1511]; bool fl[3000011]; char ch; struct node{ int cnt,p[13],g[13]; void ins(int a,int c){ int u=min(cnt+1,m+1); for(int i=1;i<=cnt;i++){ if(p[i]==a){ u=i; break; } } if(u>cnt)cnt++; for(int i=u;i>=1;i--){ ...
C++
20f5ecf8b80783e44c13179c9c5f69b4
bf0d54ec5d4397f50ca1dc767c56e3c9
2,900
PASSED
#include <array> #include <iostream> using namespace std; constexpr int maxn = 1551, maxm = 11; int n, m; array< int, maxn > w; array< int, maxn * maxn > v; array< array< int, maxn >, maxn > a; array< array< array< int, maxm >, maxn >, maxn > x, y, f, g; int main() { cin.tie( nullptr )->sync_with_s...
C++
20f5ecf8b80783e44c13179c9c5f69b4
4763b2abc174150c9432dd6731a8c820
2,900
PASSED
#include<iostream> #include<cstdio> using namespace std; #define int long long const int N=1e6+5; int n,m,k; int a[N],b[N]; int c[N]; int p[N],len; int lcm; int gcd(int a,int b){ if(!b) return a; return gcd(b,a%b); } int exgcd(int a,int b,int &x,int &y){ if(!b){ x=1,y=0; return a; } int d=ex...
C++
04f75aa0ae4a015b87ac8521cd1d34fc
1301b2439c571174cb40e19d4eb41ee8
2,200
PASSED
#include<iostream> #include<cstdio> #include<vector> using namespace std; #define int long long const int N=1e6+5; int n,m,k; int a[N],b[N],c[N]; int p[N],len; int lcm; int gcd(int a,int b){ if(!b) return a; return gcd(b,a%b); } int exgcd(int a,int b,int& x,int& y){ if(!b){ x=1,y=0; return a; ...
C++
04f75aa0ae4a015b87ac8521cd1d34fc
d276403972cb4b1585cb7279a5aca21e
2,200
PASSED
#include<iostream> #include<cstdio> #include<vector> using namespace std; #define int long long const int N=1e6+5; int n,m,k; int a[N],b[N],c[N]; int p[N],len; int lcm; int gcd(int a,int b){ if(!b) return a; return gcd(b,a%b); } int exgcd(int a,int b,int& x,int& y){ if(!b){ x=1,y=0; return a; ...
C++
04f75aa0ae4a015b87ac8521cd1d34fc
bb81b3155046c7c8117fbdeb3deff399
2,200
PASSED
#include<iostream> #include<cstdio> #include<vector> using namespace std; #define int long long const int N=1e6+5; int n,m,k; int a[N],b[N],c[N]; int p[N],len; int lcm; int gcd(int a,int b){ if(!b) return a; return gcd(b,a%b); } int exgcd(int a,int b,int& x,int& y){ if(!b){ x=1,y=0; return a; ...
C++
04f75aa0ae4a015b87ac8521cd1d34fc
e95a8fb5f2d8266d77c6b4c3441a3f86
2,200
PASSED
#include<iostream> #include<cstdio> #include<vector> using namespace std; #define int long long const int N=1e6+5; int n,m,k; int a[N],b[N],c[N]; int p[N],len; int lcm; int gcd(int a,int b){ if(!b) return a; return gcd(b,a%b); } int exgcd(int a,int b,int& x,int& y){ if(!b){ x=1,y=0; return a; ...
C++
04f75aa0ae4a015b87ac8521cd1d34fc
9515e0ae5d9b6dc6a330ef556ed2e7e0
2,200
PASSED
#include<iostream> #include<cstdio> #include<vector> using namespace std; #define int long long const int N=1e6+5; int n,m,k; int a[N],b[N],c[N]; int p[N],len; int lcm; int gcd(int a,int b){ if(!b) return a; return gcd(b,a%b); } //int exgcd(int a,int b,int& x,int& y){ // if(!b){ // x=1,y=0; // retu...
C++
04f75aa0ae4a015b87ac8521cd1d34fc
298194b55566f0dee16404ed0e25a2bc
2,200
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long const int maxn = 2e6 + 10; int n,m,k; int a[maxn],b[maxn],c[maxn],lcm1,d[maxn],cnt,x,y; bool check(int mid) { int ans = mid; for(int i = cnt; i >= 1; i--) { if(mid >= d[i]) { ans -= (mid-d[i])/lcm1 +1; } } return ans >= k; } in...
C++
04f75aa0ae4a015b87ac8521cd1d34fc
4e0ef577172c4d051453a94c6713c2b9
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e6 + 5; int n, m, k, a[N], b[N], p[N], c[N]; signed main() { ios::sync_with_stdio(false); cin >> n >> m >> k; for (int i = 0; i < n; i++) cin >> a[i]; for (int j = 0; j < m; j++) cin >> b...
C++
04f75aa0ae4a015b87ac8521cd1d34fc
ff2257b44fee5b02b35d6624ceacdccf
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll ind[1001001]; vector <ll> n, m, same; ll inverse(ll a, ll mm) { // mult. inverse of a mod m ll r = mm; ll nr = a; ll t = 0; ll nt = 1; ll tmp; while (nr != 0) { ll q = r/nr; tmp = nt; nt = t - q*nt;...
C++
04f75aa0ae4a015b87ac8521cd1d34fc
0b7eb186e2bcb6391aa0828ae85f6b5b
2,200
PASSED
// LUOGU_RID: 92482352 #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <set> #include <vector> #include <queue> #include <algorithm> using namespace std; #define int long long const int N = 500005; const int INF = 0x3f3f3f3f3f3f3f3f; vector<int> vec; in...
C++
04f75aa0ae4a015b87ac8521cd1d34fc
7f933c2fe3f7d2db97f5c3d713c87f5f
2,200
PASSED
// KiruxaLight #define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <string> #include <set> #include <map> #include <algorithm> #include <utility> #include <cmath> #include <iomanip> #include <stack> #include <deque> #include <queue> #include <cstdio> ...
C++
0d20218d672a2416a5401fa77e8a2ff0
8e781c1bd24d31254ec795aa7cbb8733
3,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; mt19937 gen(chrono::steady_clock::now().time_since_epoch().count()); struct Treap; using twoTreaps=array<Treap*,2>; struct Treap { ll val,sum; ull two; int sz,priority; twoTreaps kids;...
C++
0d20218d672a2416a5401fa77e8a2ff0
3264362cb47fc40c1d79291fd3ae8f7e
3,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const int N = 17600005; int n, Q, op, root, nodes, ls[N], rs[N], cnt[N], Cnt, L, R, p; ull x, l, r, sum[N], Sum, isum[N], Isum; inline void pushup(int rt) { cnt[rt] = cnt[ls[rt]] + cnt[rs[rt]]; sum[rt] = sum[l...
C++
0d20218d672a2416a5401fa77e8a2ff0
fbeab119ef47a152d9cfc97fc8130297
3,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const int N = 17600005; int n, Q, op, root, nodes, ls[N], rs[N], cnt[N], Cnt, L, R, p, q; ull x, l, r, sum[N], Sum, isum[N], Isum; inline void pushup(int rt) { cnt[rt] = cnt[ls[rt]] + cnt[rs[rt]]; sum[rt] = su...
C++
0d20218d672a2416a5401fa77e8a2ff0
870e4a75f9dddbf3593d2012193e3585
3,300
PASSED
#include <bits/stdc++.h> using namespace std; #define SZ(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define loop(i, a) for (int i = 0; i < (a); ++i) #define cont(i, a) for (int i = 1; i <= (a); ++i) #define circ(i, a, b) for (int i = (a); i <= (b); ++i) #define range(i, a, b, c) for (int i = (a);...
C++
0d20218d672a2416a5401fa77e8a2ff0
fae67710575aa13294f97f1e9c15fbc6
3,300
PASSED
#include<bits/stdc++.h> using namespace std; int n,m,cnt,x[200011],sum; unsigned long long f[200011],y[200011],p[400011],sz[2000011],ss[2000011],sx[2000011],sy[2000011],la; map<unsigned long long,int> mp; void up(int a){ sz[a]=sz[a*2]+sz[a*2+1]; ss[a]=ss[a*2]+ss[a*2+1]; sx[a]=sx[a*2]+sx[a*2+1]+(ss[a*2]*sz[a*...
C++
0d20218d672a2416a5401fa77e8a2ff0
e66afc660206b94dddbe9ac2e43ecf43
3,300
PASSED
#include<bits/stdc++.h> #define pb push_back #define MP make_pair #define pii pair<int,int> #define pil pair<int,ll> #define pli pair<ll,int> using namespace std; typedef long long ll; const int N=200005; int n,m,nn,rt,op[N]; ll a[N],b[N],c[N<<1]; struct SEG_TREE{ #define ls(p) tr[p].ls #define rs(...
C++
0d20218d672a2416a5401fa77e8a2ff0
6cf6899daea14cba3eb718b121f351d3
3,300
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef __int128 Ty; typedef pair<ll,Ty> Pair; const int N=4e5+5; #define ls now<<1 #define rs now<<1|1 Ty v2[N<<2]; ll v1[N<<2],a[N],x[N],seq[N]; int siz[N<<2],tag[N<<2],op[N],vis[N]; int n,q,len,T,cur,rr; ll tot; set<ll> S; map<ll,int> M; ...
C++
0d20218d672a2416a5401fa77e8a2ff0
1ff1edfb6ff2da18efcc2cd1f558353c
3,300
PASSED
#include<bits/stdc++.h> using namespace std; #define ls LS[cur] #define rs RS[cur] const int N=200005; typedef long long ll; const ll Inf=1e13; int n,Q,rt,node; struct node { int sz; ll sum,suml,sumr; } Tree[N*60]; int LS[N*60],RS[N*60]; void pushup(int cur) { Tree[cur].sz=Tree[ls].sz+Tree[rs].sz; ...
C++
0d20218d672a2416a5401fa77e8a2ff0
d55f3849504b467baea181c6bb2d023d
3,300
PASSED
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("O3") typedef pair<int, int> ii; const bool debug = false; const long long NUM_BUCKETS = 600; const int INIT_EVERY = 800; int n, m, q; int t[200005]; long long a[200005]; long long s[400005]; struct sqrtDecomp{ long long ...
C++
0d20218d672a2416a5401fa77e8a2ff0
b2d9be11c2afe6f921a6947ffcf49f6d
3,300
PASSED
#include <cstdio> #include <list> #include <assert.h> #include <algorithm> #define ll long long #define x first #define y second using std::pair; using std::list; const int N=1000005; namespace iobuff{ const int LEN=1000000; char in[LEN+5], out[LEN+5]; char *pin=in, *pout=out, *ed=in, *eout=out+LEN; ...
C++
ad512e1188453c441f850f67497851e1
769dcc9cbe287fc8a4f264c829775712
3,500
PASSED
#include <cstdio> #include <queue> #include <assert.h> #include <algorithm> #define ll long long #define x first #define y second using std::pair; using std::deque; const int N=1000005; namespace iobuff{ const int LEN=1000000; char in[LEN+5], out[LEN+5]; char *pin=in, *pout=out, *ed=in, *eout=out+LEN;...
C++
ad512e1188453c441f850f67497851e1
e64a0edf5a813f7424062ffa6cb9a01d
3,500
PASSED
#include <cstdio> #include <queue> #include <assert.h> #include <algorithm> #define ll long long #define x first #define y second using std::pair; using std::deque; const int N=1000005; int n, rev, typ[N]; ll C, w[N], l[N], r[N], h[N], pr[N], off; deque<pair<ll, int> > q; inline void procrev(ll w) { rev...
C++
ad512e1188453c441f850f67497851e1
6bc1a57a91c2a9bbd891cbe8c3b2e614
3,500
PASSED
#include<bits/stdc++.h> #define For(i,x,y) for (int i=(x);i<=(y);i++) #define FOR(i,x,y) for (int i=(x);i<(y);i++) #define Dow(i,x,y) for (int i=(x);i>=(y);i--) #define Debug(v) for (auto i:v) cout<<i<<" ";puts("") #define mp make_pair #define fi first #define se second #define pb push_back #define ep emplace_...
C++
ad512e1188453c441f850f67497851e1
cccdde1495b4cccfb193533bb063d799
3,500
PASSED
//#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> typedef long long ll; using namespace std; #define endl '\n' const int N=1000010; const int mod=1000000007; ll w[N]; ll diff[N]; ll ans[N]; ll h[N]; bool used[N]; int...
C++
ad512e1188453c441f850f67497851e1
3970ca9ea631d4b7f46f22ecb68f6ef3
3,500
PASSED
//#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> typedef long long ll; using namespace std; #define endl '\n' const int N=1000010; ll w[N]; ll diff[N]; ll ans[N]; ll h[N]; bool used[N]; int pr[N][2]; int type[N][2];...
C++
ad512e1188453c441f850f67497851e1
63200279070ee12ec824b81229e01b33
3,500
PASSED
//#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> typedef long long ll; using namespace std; #define endl '\n' const int N=1000010; ll w[N]; ll diff[N]; ll ans[N]; ll h[N]; bool used[N]; ll pr[N][2]; ll type[N][2]; ...
C++
ad512e1188453c441f850f67497851e1
75d3f1c75eb281d6754355936b8c0abd
3,500
PASSED
//#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> typedef long long ll; using namespace std; #define endl '\n' const int N=1000010; ll w[N]; ll diff[N]; ll ans[N]; ll h[N]; bool used[N]; ll pr[N][2]; ll type[N][2]; ...
C++
ad512e1188453c441f850f67497851e1
c3c7e6d8c001a226e732b5f302a1bab4
3,500
PASSED
//#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> typedef long long ll; using namespace std; #define endl '\n' const int N=1000010; const int mod=1000000007; #define int ll ll w[N]; ll diff[N]; ll ans[N]; ll h[N]; bo...
C++
ad512e1188453c441f850f67497851e1
18c231a8bab75445835409b571f08707
3,500
PASSED
#include <bits/stdc++.h> [[noreturn]] void FAIL() { std::cout << "NO" << '\n'; exit(0); } int main() { using namespace std; ios_base::sync_with_stdio(false), cin.tie(nullptr); int N; int64_t C; cin >> N >> C; vector<int64_t> W(N-2); for (auto& w : W) cin >> w; W.push_back(W.back()); // there ...
C++
ad512e1188453c441f850f67497851e1
c138ac6736132543d2f0f2c64523e0cc
3,500
PASSED
import kotlin.jvm.JvmStatic import java.lang.Math import java.util.* object programkt { @JvmStatic fun main(args: Array<String>) { val sc = Scanner(System.`in`) // int cases = sc.nextInt(); // while (cases-- > 0) { var a1 = sc.nextInt() var a2 = sc.nextI...
Kotlin
2be8e0b8ad4d3de2930576c0209e8b91
11751d798b2c87509dc225ae396c3bb6
-1
PASSED
private fun readLn() = readLine()!! // string line private fun readInt() = readLn().toInt() // single int private fun readLong() = readLn().toLong() // single long private fun readDouble() = readLn().toDouble() // single double private fun readStrings() = readLn().split(" ") // list of strings private fun readInts...
Kotlin
2be8e0b8ad4d3de2930576c0209e8b91
a2d6ef1428acb7ec83c53313a026c483
-1
PASSED
import java.util.* class Football { fun run(){ val scanner = Scanner(System.`in`) val aCount = scanner.nextInt() val bCount = scanner.nextInt() val aK = scanner.nextInt() val bK = scanner.nextInt() var n = scanner.nextInt() var min = aCount + bCo...
Kotlin
2be8e0b8ad4d3de2930576c0209e8b91
2dde8cb8613b053d11cd2b02316a32e0
-1
PASSED
 import java.lang.AssertionError private fun readLn() = readLine()!! //string line private fun readInt() = readLn().toInt() //single int private fun readLong() = readLn().toLong() //single long private fun readDouble() = readLn().toDouble() //single double private fun readStrings() = readLn().split(" ") /...
Kotlin
2be8e0b8ad4d3de2930576c0209e8b91
de6ddd24fecba89cbf3ca5b3dd38c7b6
-1
PASSED
import kotlin.math.max fun main() { val (a1, a2, k1, k2, n) = List(5) { readLine()!!.toInt() } var max = 0 var max1 = 0 var max2 = 0 val team1Product = a1 * k1 val team2Product = a2 * k2 if (n > team1Product && n > team2Product) { max1 = (a1 + ((n - team1Product) / k2)...
Kotlin
2be8e0b8ad4d3de2930576c0209e8b91
679fdc455731415c797a25b88f1e0ba2
-1
PASSED
import kotlin.math.max import kotlin.math.min fun main() { val a1 = readLine()!!.toInt() val a2 = readLine()!!.toInt() val k1 = readLine()!!.toInt() val k2 = readLine()!!.toInt() val n = readLine()!!.toInt() // max val maxres = if (k1 < k2) { val tmp = min(n / k1, a1) ...
Kotlin
2be8e0b8ad4d3de2930576c0209e8b91
fa25cd9cca3777d6bfc05d472fe9755b
-1
PASSED
import java.util.* import java.lang.* fun main () { val a1 = Integer.valueOf(readLine()) val a2 = Integer.valueOf(readLine()) val k1 = Integer.valueOf(readLine()) val k2 = Integer.valueOf(readLine()) val n = Integer.valueOf(readLine()) if(k1>k2){ if(k2*a2>n){ var maxans:Int ...
Kotlin
2be8e0b8ad4d3de2930576c0209e8b91
96dc1e7a7fa7c03a7f34abc101d3b4de
-1
PASSED
import java.util.Scanner /** * B. Yellow Cards * Input * 2 * 3 * 5 * 1 * 8 * Output * 0 4 */ fun main() { val scanner = Scanner(System.`in`) val numberOfPlayersInTeamOne = scanner.nextLine().trim().toInt() val numberOfPlayersInTeamTwo = scanner.nextLine().trim().toInt() ...
Kotlin
2be8e0b8ad4d3de2930576c0209e8b91
cbbcc8c7d5422c01399bade03d010e55
-1
PASSED
/** * 10/04/21 night * https://codeforces.com/contest/1570/problem/A */ // package codeforce.kotlin_heros.practice_8 import java.util.* import java.io.* fun solve(a1: Int, a2: Int, k1: Int, k2: Int, n: Int) { var min = n - a1 * (k1 - 1) - a2 * (k2 - 1) if (min < 0) min = 0; prt("$min ") ...
Kotlin
2be8e0b8ad4d3de2930576c0209e8b91
de374f2661bc35ece9ce3d2544bca55f
-1
PASSED
fun main() { var a1 = readLine()!!.toInt() var a2 = readLine()!!.toInt() var k1 = readLine()!!.toInt() var k2 = readLine()!!.toInt() var n = readLine()!!.toInt() var minimum = Math.max(0, n-(a1*k1 - a1 + a2*k2 - a2)) if(k1 > k2) { var tmp = a1 a1 = a2 a2 = t...
Kotlin
2be8e0b8ad4d3de2930576c0209e8b91
75f2925701bb7ee053e145ad27003809
-1
PASSED
import java.io.PrintWriter// {{{ import java.lang.Integer.min import kotlin.collections.*// }}} private const val MAX_N = 100_001 private const val P = 2000 private val cnt = IntArray(MAX_N) { 0 } private val ord = IntArray(MAX_N) { 0 } private val bounds = Array(MAX_N) { Point(MAX_N, 0) } data class Query(val t: In...
Kotlin
6c39c72b57a48e0560a32fddaa5713e1
86c8afd15bddde8af8893a5f9bf48e9b
-1
PASSED
interface Query data class Change(val i: Int, val x: Int): Query data class Ask(val l: Int, val r: Int, val k: Int, var ans: Int = Int.MAX_VALUE): Query fun oversolve(test: Int) { val (n, m) = read.ints val ta = read.ints val queries = mutableListOf<Query>() for (i in 0 until m) { val line = r...
Kotlin
6c39c72b57a48e0560a32fddaa5713e1
3c00942bdef46a30d58cb87ea29a50de
-1
PASSED