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> #define ll long long #define pb push_back #define F first #define S second #define mp make_pair #define PII pair<ll,ll> #define PLL pair<long long,long long> #define M map #define UM unordered_map #define V #define MOD 1000000007 #define P pair #define test ll t; cin>>t; while(t--) #define Fas...
C++
6e093dbcbcaa7c87c9b62546745984db
adad45d1a34cff76fb0ee1d06bace48e
1,500
PASSED
#include <bits/stdc++.h> #define ll long long #define pb push_back #define F first #define S second #define mp make_pair #define PII pair<ll,ll> #define PLL pair<long long,long long> #define M map #define UM unordered_map #define V #define MOD 1000000007 #define P pair #define test ll t; cin>>t; while(t--) #define Fas...
C++
6e093dbcbcaa7c87c9b62546745984db
a7de406f28d5350335ebab1bc2ad4e2f
1,500
PASSED
#include <bits/stdc++.h> #define ll long long #define pb push_back #define F first #define S second #define mp make_pair #define PII pair<ll,ll> #define PLL pair<long long,long long> #define M map #define UM unordered_map #define V #define MOD 1000000007 #define P pair #define test ll t; cin>>t; while(t--) #define Fas...
C++
6e093dbcbcaa7c87c9b62546745984db
104e3d571745e27d9fb7480d20a042a2
1,500
PASSED
#include<bits/stdc++.h> #define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);} #define inf 1e18 #define ld long double #define pb push_back #define fi first #define mod 998244353 #define se second typedef long long int ll; using namespace std; ll power(ll a,ll b){ if(b==0) return 1; else return a*power(a,b-...
C++
6e093dbcbcaa7c87c9b62546745984db
af04bfe7703271b5ba7e91a021d56915
1,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[90][90], f[90][20], c[90]; int main() { srand(time(0)); double st = clock(); int n, k; scanf("%d%d", &n, &k); for(int i=1; i<=n; i++) { for(int j=1; j<=n; j++) { scanf("%d", &a[i][j]); } } int ans = 1e9; while((clock()-st)/CLOCKS...
C++
941ef8c3dd64e269d18fc4dfce7165e0
703e37bba5f01cc9a696fd767fcc60fd
2,300
PASSED
#include<bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define Fast_IO ios::sync_with_stdio(false); #define fir first #define sec second #define mod 998244353 #define INF 0x3fffffff #define ll long long inline int read() { char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') ...
C++
941ef8c3dd64e269d18fc4dfce7165e0
e66e7ebb06ff46f6caaea350acdf25f0
2,300
PASSED
//problem:CF1314D #include <bits/stdc++.h> using namespace std; #define pb push_back #define mk make_pair #define lob lower_bound #define upb upper_bound #define fst first #define scd second typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; namespace Fread{ c...
C++
941ef8c3dd64e269d18fc4dfce7165e0
5d3647a7484ad5d747b54e1ec1a91751
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll inf=2e9; const int maxn=100; int flag[maxn]; int a[maxn][maxn],A[maxn],top; int n,m; pair <int,int> f[maxn][maxn][maxn]; ll ans; int d(int x,int y) { int i; for (i=1;i<=n;i++) { if (!flag[f[x][y][i].second]) { retur...
C++
941ef8c3dd64e269d18fc4dfce7165e0
48a832e9f4746f4c0a709f65d53aa1c2
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define FOR(x,n) for(int x=0;x<n;x++) #define mp make_pair typedef long long ll; typedef pair<int,int> iPair; int cost[80][80]; vector<iPair> mincost[80][80]; int n, k; int ans = INT_MAX; void solve(vector<int>& choose, vector<int>& nok) { if(choose.size() == k/2) {; ...
C++
941ef8c3dd64e269d18fc4dfce7165e0
a07dc8ec9410ce75a41ef1f1bf95ec39
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int sz=85, inf=1e9; typedef pair <int,int> pii; #define x first #define y second set <int> st; bitset <sz> vis; vector <pii> d[sz][sz]; int n, m, a[sz][sz], ans=inf; inline void fnc(int ara[]) { vector <int> now; now.push_back(1); ...
C++
941ef8c3dd64e269d18fc4dfce7165e0
3121a9148ba6e927184d1b73cf0eb645
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int sz=85, inf=1e9; typedef pair <int,int> pii; #define x first #define y second bitset <sz> vis; vector <pii> d[sz][sz]; int n, m, a[sz][sz], ans=inf; inline void fnc(int now[], int z) { int dis[6][5], r[5][5]; for(int i=0; i<z; i++)...
C++
941ef8c3dd64e269d18fc4dfce7165e0
124aa709dc7e5bf5e53d48d6e7407f55
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int sz=85, inf=1e9; typedef pair <int,int> pii; #define x first #define y second set <int> st; vector <pii> d[sz][sz]; int n, m, a[sz][sz], ans=inf; void fnc() { vector <int> now; now.push_back(1); for(auto it : st) now.push_back(...
C++
941ef8c3dd64e269d18fc4dfce7165e0
428133cbb9ed634047edf73da6e7be1a
2,300
PASSED
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n,m,g[105][105],a[105][105][105],vis[105],nwu,nwv,ans=1e9; int b[15]; bool cmp(const int x,const int y) { return g[nwu][x]+g[x][nwv]<g[nwu][y]+g[y][nwv]; } int getans(int u,int v) { for(int i=1;i<=a[u][v][0];i++) { int val=a[u][v][i]; ...
C++
941ef8c3dd64e269d18fc4dfce7165e0
e9acb3cfa5e92889f2dc5b5cb7874c07
2,300
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; int n,k; int w[85][85]; int z[4][85][85],pos[4][85][85]; int T[6]; int ans=2e9; void upd(int i,int j,int u) { for(int t=0;t<4;t++) { if(w[i][u]+w[u][j]<=z[t][i][j]) { for(int p=3;p>t;p--) { z[p][i][j]=z[p-1][i][j]; pos[p][i][j]=...
C++
941ef8c3dd64e269d18fc4dfce7165e0
a82b9dd355b41926ecb9d05ed1ef02ed
2,300
PASSED
//package round623; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; public class B { InputStream is; PrintWriter out; String INPU...
Java
43501b998dbf4c4fef891a8591e32a42
ffcf72707630d7d95c45a251106ac181
2,500
PASSED
#include <bits/stdc++.h> // Tomasz Nowak using namespace std; // XIII LO Szczecin using LL = long long; // Poland #define FOR(i, l, r) for(int i = (l); i <= (r); ++i) #define REP(i, n) FOR(i, 0, (n) - 1) template<class T> int size(T &&x) { return int(x.size()); } template<class A, class B> ostream& operator<<(o...
C++
43501b998dbf4c4fef891a8591e32a42
2887ea3b1fc491e022dc33293440c17b
2,500
PASSED
#include<stdio.h> #include<iostream> #include<vector> #include<algorithm> #include<string> #include<string.h> #ifdef LOCAL #define eprintf(...) fprintf(stderr, __VA_ARGS__) #else #define NDEBUG #define eprintf(...) do {} while (0) #endif #include<cassert> using namespace std; typedef long long LL; typedef vector<int...
C++
43501b998dbf4c4fef891a8591e32a42
4d33bf2a2101fce550452b23f47435f8
2,500
PASSED
#include <iostream> #include <vector> #include <set> #include <map> #include <assert.h> #include <algorithm> #include <random> #include <string> #define endl '\n' using namespace std; vector<int> merge(vector<int> &a, vector<int> &b) { vector<int> c(4, -1000000); for (int i = 0; i < 4; ++i) { for (i...
C++
43501b998dbf4c4fef891a8591e32a42
021804a99bf80b9b8387a012266761f2
2,500
PASSED
#include<iostream> #include<string.h> #include<string> #include<stdio.h> #include<algorithm> #include<vector> #include<bitset> #include<math.h> #include<stack> #include<queue> #include<set> #include<map> using namespace std; typedef long long ll; typedef long double db; typedef vector<int> vi; typedef pair<int,int> pii...
C++
43501b998dbf4c4fef891a8591e32a42
e0eca6bb87719a401d67bbd665b8829a
2,500
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; using vb = vector<bool>; using...
C++
43501b998dbf4c4fef891a8591e32a42
a60c02d3671a02752c6d2a2607098e42
2,500
PASSED
#include <bits/stdc++.h> using namespace std; // template {{{ #define pb push_back #define eb emplace_back #define mp make_pair #define mt make_tuple #define lb lower_bound #define ub upper_bound #define f first #define s second #define resz resize #define sz(x) int((x).size()) #define all(x) (x).begin(), (x).end() ...
C++
43501b998dbf4c4fef891a8591e32a42
644d78596ee200c9510065769cb20e9f
2,500
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <set> #include <map> using namespace std; char our[200020]; long long int dp[20][200200][4]; /* 0-нет членов 1-член вверху 2-член внизу 3-оба члена */ int main() { const int inf=1e9; for (int i=0;i<20;i++) ...
C++
43501b998dbf4c4fef891a8591e32a42
29e6fe6484259df0f03251d44109659e
2,500
PASSED
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() using ll = long long; template <typename T> using posteriority_queue = priority_queue<T, vector<T>, greater<T> >; const int INF = 0x3f3f3f3...
C++
43501b998dbf4c4fef891a8591e32a42
14698234e844c70ee4a157a338c5369d
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=3e5+7; const ll inf=1e8; const ll inff=1e18; const ll mod=1e9+7; #define pii pair<int,int> #define mkp make_pair #define F first #define S second #define pb push_back #define sz(v) ((int)(v).size()) #define all(v) (v).begin(),(v).end() ...
C++
43501b998dbf4c4fef891a8591e32a42
e60828cb8bb5ca2bf5b316f378995b5e
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define f first #define s second #define mp make_pair #define pb push_back #define all(x) x.begin(), x.end() #define sz(x) ((int)x.size()) int n, m, k; int c[200005]; vector <pair <int, int> > v, va, vb; set <pair <int, int> ...
C++
9091de9fad568e353d7b3462cebe2571
d687ccfc3816091fb6de05f710ac59cf
2,500
PASSED
#include<bits/stdc++.h> using namespace std; using INT = long long; #define NN 201000 int n, m, k; int c[NN]; int cnt[NN]; int e(multiset<int> &st, int u) { // if(st.count(u) == 0) assert(0); st.erase(st.find(u)); } int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout)...
C++
9091de9fad568e353d7b3462cebe2571
cafe66d81d21f86e778425b5eb19be13
2,500
PASSED
#include <bits/stdc++.h> #define SZ(x) ((int) (x).size()) using namespace std; int main() { #ifdef LOCAL_RUN freopen("task.in", "r", stdin); freopen("task.out", "w", stdout); //freopen("task.err", "w", stderr); #endif // ONLINE_JUDGE ios::sync_with_stdio(false); cin.tie(0); int n, m, k...
C++
9091de9fad568e353d7b3462cebe2571
4ba1345209eef820fda02e2b97ce3e02
2,500
PASSED
#include<bits/stdc++.h> using namespace std; using ll = long long; int n,m,k; int t,x; int c[200010]; int f1[200010]; int f2[200010]; vector<int> w, a, b; vector<int> d; vector<ll> ww, aa, bb, dd; int main() { ios::sync_with_stdio(false); cin>>n>>m>>k; for (int i=0;i<n;i++) cin>>c[i]; cin>>t; for (int i=0;i<t;...
C++
9091de9fad568e353d7b3462cebe2571
2c80efbcc22ce7064753f01556a1fb38
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define REP(i,j) for(int i = 0 ; i < j ; i++) #define REPNM(i,j,k) for(int i = j ; i < k ; i++) #define RREP(i,j,k) for(int i = j ; i >=k ; i--) #define A first #define B second #define pb push_back #define mp make_pair #define PII pair<int , int> #defi...
C++
9091de9fad568e353d7b3462cebe2571
120bc631c8d59067d1ea17d3d928c5e6
2,500
PASSED
#pragma comment(linker, "/stack:20000000") #pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx") #define _CRT_SECURE_NO_WARNINGS # include <iostream> # include <cmath> # include <algorithm> # include <stdio.h> # include <cstring> # include <string> # include <cstdlib> # include <...
C++
9091de9fad568e353d7b3462cebe2571
5929b1a46b7372922bea6e42f96903b1
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll ; #define int ll const int N = (int)2e5 + 9; int tt[N]; bool g1[N]; bool g2[N]; signed main(){ int n, m, k ; cin >> n >> m >> k; for(int i = 1; i <= n; i ++ ){ cin >> tt[i]; } int a, x; cin >> a; for(int i = 0; i...
C++
9091de9fad568e353d7b3462cebe2571
3cbd82df4fb78eccb50c1a94f7bcd0a9
2,500
PASSED
#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 gp_hash_table<int, null_type,hash<int>, equal_to<int>, dir...
C++
9091de9fad568e353d7b3462cebe2571
8d819dc383bd4bd554f6c27bb844d2bb
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0) char _; #define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end()) #define all(a) a.begin(),a.end() #define println printf("\n"); #define readln(x) get...
C++
9091de9fad568e353d7b3462cebe2571
9b6e060847b035c8f93e16a22a32ebca
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0) char _; #define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end()) #define all(a) a.begin(),a.end() #define println printf("\n"); #define readln(x) get...
C++
9091de9fad568e353d7b3462cebe2571
4224c6129063e945e38dcf46ddf27835
2,500
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <string> #include <algorithm> #include <stack> #include <queue> #include <set> #include <map> #include <vector> #define POS(x) x+n using namespace std; typedef pair<int,int> P; typedef __int64 ll; const int maxn = 400005; ll c[2][maxn]...
C++
2ca6c11715c158681323fb62a068a236
6e7629225c8d4f035bf4aa4edbbf8340
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define maxn 200010 #define ll long long int n,m; int a[maxn]; int num[maxn<<1]; ll cal(int x) { memset(num,0,sizeof(num)); int sum=n; ll ret=0,now=0; num[sum]=1; for(int i=1;i<=n;i++) { if(a[i]<x)now-=num[--sum]; else now+=num[sum++];...
C++
2ca6c11715c158681323fb62a068a236
22b8d63dea20233abb4eaad900079eb0
2,400
PASSED
#include<bits/stdc++.h> #define LL long long using namespace std; const int N=2e5+50; int n,m,a[N],num[N*2]; LL solve(int x){ LL ret=0;memset(num,0,sizeof(num));num[n]=1; for(int i=1,now=0,dat=0;i<=n;i++){ if(a[i]>=x)dat+=num[now+n],now++; else now--,dat-=num[now+n]; num[now+n]++;ret+=da...
C++
2ca6c11715c158681323fb62a068a236
af49c882b725ebe3aa04f9815c10b1f7
2,400
PASSED
#include <stdio.h> #define ll long long const int N=200050; const int M=2*N; int cnt[M],a[N]; void Init(){ for(int i=0;i<M;i++) cnt[i]=0;} void Set(int i){ for(;i<M;i+=i&-i) cnt[i]++;} int Get(int i){ int ret=0;for(;i;i-=i&-i) ret+=cnt[i];return ret;} int main() { int n,m,i; scanf("%i %i",&n,&m); Set(N); int sum=0;...
C++
2ca6c11715c158681323fb62a068a236
43c194646f61ed7e00f8a362e19ba73a
2,400
PASSED
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <vector> #include <queue> #include <stack> #include <cstdlib> #include <iomanip> #include <cmath> #include <cassert> #include <ctime> #include <map> #include <set> using namespace std; #pragma comment(linker, "/stck:1024000000,102400...
C++
2ca6c11715c158681323fb62a068a236
e440eb35316cbb310c7b7cfa71e4cbfd
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define long long long template<class T> inline void MIN(T &a, T b) { if (a > b) a = b; } template<class T> inline void MAX(T &a, T b) { if (a < b) a = b; } const int N = 2e5 + 5; int n, m, a[N], f[2 * N]; void inc(int idx) { idx += N; while (idx < 2 * N) { f[idx]++...
C++
2ca6c11715c158681323fb62a068a236
53cc03e8902f51f8cfe581783077e53b
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define long long long const int N = 2e5 + 5; int n, m, a[N], b[2 * N]; long solve(int k) { int cur = N, ok = 0; long ret = 0; memset(b, 0, sizeof(b)); ++b[cur]; for (int i = 0; i < n; i++) { if (a[i] <= k) ok += b[++cur]; else ok -= b[cur--]; ret += ok; ++b[cur...
C++
2ca6c11715c158681323fb62a068a236
1c126918000cd14cc5e2ddbc2923cc20
2,400
PASSED
#include <iostream> #include <stdio.h> #include <vector> #include <algorithm> using namespace std; #define fi(a,b,c) for(int a=b;a<=c;a++) #define fo(a,b,c) for(int a=b;a>=c;a--) #define long long long const int N = 5e5+1; const int M = 2e5; int n, m; long a[N], c[N], d[N], e[N]; void Reset(){ fi(i,0,N-1) d[...
C++
2ca6c11715c158681323fb62a068a236
48f03ff912f779086a44819d5bf69f93
2,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define inf 0x3f3f3f3f #define INF 1e19 #define LBW return #define AK 0 #define IOI ; #define int ll template <typename T> void chmin(T &x,const T &y){if(x>y)x=y;} template <typename T> void chmax(T &x,const T &y){if(x<y)x=y;} inline int read() { int x...
C++
2ca6c11715c158681323fb62a068a236
fe8cceb1034bea4927f667bddc23c3ee
2,400
PASSED
#include <bits/stdc++.h> #include <chrono> using namespace std::chrono; typedef long long ll; typedef unsigned int uint; typedef unsigned short ushort; typedef unsigned long long ull; typedef double db; typedef unsigned char uchar; using namespace std; #define var auto #define rep(i,a,b) for(int i=a, lim__lim=(b); ...
C++
2ca6c11715c158681323fb62a068a236
1a3135b425724100a2d6ed76b760915e
2,400
PASSED
/* 对于一个区间[L,R]dp,一个位置是x,之前应该有一段[l,r]且r-l+1=x-l,且a[x]<min或a[x]>max min,max表示a[l,r]中的最小值和最大值 首先我们可以发现除了第一个人, 其他人都会坐在已入坐人的旁边。 我们可以从外往里把确定的人用组合数算上去,然后缩小范围。 https://blog.csdn.net/weixin_30670925/article/details/94874969 */ #include <bits/stdc++.h> using namespace std; typedef long long ll; inline ll read() { ll S=0...
C++
da8c8d0d54de6b2cb82e30e42f025913
dcaa3cd6dba30bfdb65788b19838ccf8
2,500
PASSED
/* 对于一个区间[L,R]dp,一个位置是x,之前应该有一段[l,r]且r-l+1=x-l,且a[x]<min或a[x]>max min,max表示a[l,r]中的最小值和最大值 首先我们可以发现除了第一个人, 其他人都会坐在已入坐人的旁边。 我们可以从外往里把确定的人用组合数算上去,然后缩小范围。 https://blog.csdn.net/weixin_30670925/article/details/94874969 */ #include <bits/stdc++.h> using namespace std; typedef long long ll; inline ll read() { ll S=0...
C++
da8c8d0d54de6b2cb82e30e42f025913
4b4e7d4dfa4aa0e0b897ed2d604fa30a
2,500
PASSED
#include <cstdio> #include <cstring> #include <algorithm> const int N = 1e5+10; const int RXD = 1e9+7; using namespace std; struct data{int pos,id;} a[N]; int f[N],g[N],n,tot,ans; int read(){ int x = 0,f = 1,c = getchar(); while (c<'0' || c>'9') {if (c=='-') f = -1;c = getchar();} while (c>='0' && c<='9') x = x*10+c...
C++
da8c8d0d54de6b2cb82e30e42f025913
bd943ff767368aa4a0b7be81712203ab
2,500
PASSED
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <string> using namespace std; #define ll __int64 const int inf = 1e5+10; const int mod = 1e9+7; pair<int, int>a[inf]; int n, x, tot; ll ans, ai[inf], bi[inf]; ll mul(ll x, int num) { ll e = 1; while(num) { if(num&1) e = (x*e)%mo...
C++
da8c8d0d54de6b2cb82e30e42f025913
964f55997cfefe0e0f669fc10792a715
2,500
PASSED
//File Name: cf380D.cpp //Author: long //Mail: 736726758@qq.com //Created Time: 2016年05月20日 星期五 00时32分29秒 #include <stdio.h> #include <iostream> #include <algorithm> #include <string.h> #include <stdlib.h> #include <math.h> #include <map> #define LL long long #defi...
C++
da8c8d0d54de6b2cb82e30e42f025913
41978bfdda478ef43d0b229158ca265b
2,500
PASSED
#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; tree<pair<long long, long long>, null_type, less<pair<long long, long long>>, rb_tree_tag, tree_order_statistics_node_update> st; */ /* st.find_by_order(); st....
C++
c23efec5ead55d9adee703c3ff535b94
557947bfcbc8070eaff155fe64b0ac4d
2,000
PASSED
///-------DäMON_RJWALKERS_FAçON-------- #include<bits/stdc++.h> using namespace std; typedef vector<int> vi; const bool testcases = 1; #define mark ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define test int __T__ = 1;if(testcases)cin >> __T__;while(__T__--) #define endl "\n" #define ll long long #define lli...
C++
c23efec5ead55d9adee703c3ff535b94
9726da18347eb0648a415091a7c8bc36
2,000
PASSED
///-------DäMON_RJWALKERS_FAçON-------- #include<bits/stdc++.h> using namespace std; typedef vector<int> vi; const bool testcases = 1; #define mark ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define test int __T__ = 1;if(testcases)cin >> __T__;while(__T__--) #define endl "\n" #define ll long long #define lli...
C++
c23efec5ead55d9adee703c3ff535b94
a434324a1f0a1d9d765eabfd63cdedce
2,000
PASSED
#include<iostream> #include<cstdio> #include<vector> #include<string> #include<algorithm> #include<queue> #include<map> using namespace std; struct node{ int pid,pre,u,ti; }f,q[300010]; string s; int u,v,n,m,k,a,b,c,r,l; vector<int> g[3010]; map<string,bool> mp,mp2; string str(int x){ string s=""; if(x==0)s...
C++
c23efec5ead55d9adee703c3ff535b94
ce8f77cbbdb7d936d81350426c896414
2,000
PASSED
#include <bits/stdc++.h> #define ll long long #define F first #define S second using namespace std; const int N = 3e3 + 5; const int INF = 1e9 + 7; int d[N][N]; short pr[N][N]; map <pair <pair <short, short>, short>, bool> mp; vector <short> g[N]; bool u[N][N]; void out(short x, short y) { vector <short> res; ...
C++
c23efec5ead55d9adee703c3ff535b94
e43a65a9bfbb6a03f1ece708c052d81b
2,000
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <utility> #include <cstring> #include <queue> using namespace std; vector< vector< int > > adj_list{}; vector< int > blocked_from[3001][3001]; int max_checks_poss[3001]; int checks_done[3001]; int dis[3001][3001]; // last, now const...
C++
c23efec5ead55d9adee703c3ff535b94
0e1eabde55cf984cf6fa50361d785974
2,000
PASSED
#pragma GCC optimize(2) #include<iostream> #include<cstdio> #include<vector> #include<string> #include<algorithm> #include<queue> #include<map> using namespace std; struct node{ int pid,pre,u,ti; }f,q[300010]; string s; int u,v,n,m,k,a,b,c,r,l; vector<int> g[3010]; map<string,bool> mp,mp2; string str(int x){ st...
C++
c23efec5ead55d9adee703c3ff535b94
fe166a0ecfa4aeee1175e4f9b9ad4d37
2,000
PASSED
//In the name of Allah //Ya Ali! #include <bits/stdc++.h> using namespace std; typedef int ll ; const ll maxn = 3010 ; const ll maxx = 9000000 ; const ll max2 = 21 ; const ll INF = 1e18 ; #define f first #define s second ll n , m , k , mark[maxx] , dis[maxx] , par[maxx] , nod1[maxn][maxn] , nod = 0 ; queue<ll> qu ...
C++
c23efec5ead55d9adee703c3ff535b94
f938b981cbb785e6db76329eb17c3706
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int OO = 0x3f3f3f; set<pair<int,pair<int,int>>> disaster; vector<pair<int,int>> road; vector<int> ans; vector<int> adj[3005]; int n,m,k,u,v,a,b,c; int bfs() { int parent[3005][3005],distance[3005][3005]; memset(distance,OO,sizeof(distance)); distance[0]...
C++
c23efec5ead55d9adee703c3ff535b94
b558ab370acd5506b0f0809f74459874
2,000
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 2e18L + 5; const ll MX = 3e3 + 9; const ll MOD = 1e1 + 7; #define f first #define s second ll n,m,k; //ll dis[MX][MX]; vector<vector<ll>> dis(MX, vector<ll>(MX)); bool ok[MX][MX]; ll par[MX][MX]; map<tuple<ll,ll,ll>, bool> ban; ll last_p...
C++
c23efec5ead55d9adee703c3ff535b94
33777feb3f20be25f93208e59cfe2aba
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define maxn 200010 struct Point { long long x, y; bool operator < (const Point& rhs) const { return x == rhs.x ? y < rhs.y : x < rhs.x; } }; Point operator - (Point a, Point b) { return (Point) {a.x - b.x, a.y - b.y}; } long long cross(Point a, Point b) { return...
C++
d9eb0f6f82bd09ea53a1dbbd7242c497
11df6b84f8c98d727b56cdd416d97ffa
2,100
PASSED
#include <cstdio> #include <algorithm> #include <vector> using namespace std; struct Point { long long x, y; int id; Point operator - (const Point& rhs) const { return (Point) {x - rhs.x, y - rhs.y, 0}; } bool operator < (const Point& rhs) const { return x == rhs.x ? y < rhs.y : x < rhs.x; } }; vector<Point...
C++
d9eb0f6f82bd09ea53a1dbbd7242c497
d81572179891e8858ed4d21d4873ac67
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define maxn 200010 struct Point { long long x, y; bool operator < (const Point& rhs) const { return x == rhs.x ? y < rhs.y : x < rhs.x; } }; Point operator - (Point a, Point b) { return (Point) {a.x - b.x, a.y - b.y}; } long long cross(Point a, Point b) { return...
C++
d9eb0f6f82bd09ea53a1dbbd7242c497
5aaafddc4676cb6bdefa9fb350ac4525
2,100
PASSED
// #pragma GCC optimize("O3") #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define N 1000000007 #define N2 998244353 #define Nmax 3000005 #define INF (ll)1e18 #define pll pair<ll,ll> #define mp make_pair #define fi first #define se second #define vv vector #define rep(i,n) rep2...
C++
d9eb0f6f82bd09ea53a1dbbd7242c497
1d385a0e41acbc90784136be07dff47e
2,100
PASSED
// #pragma GCC optimize("O3") #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define N 1000000007 #define N2 998244353 #define Nmax 3000005 #define INF (ll)1e18 #define pll pair<ll,ll> #define mp make_pair #define fi first #define se second #define vv vector #define rep(i,n) rep2...
C++
d9eb0f6f82bd09ea53a1dbbd7242c497
da09e9fcbf279bd1c79778a13b88340f
2,100
PASSED
// #pragma GCC optimize("O3") #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define N 1000000007 #define N2 998244353 #define Nmax 3000005 #define INF (ll)1e18 #define pll pair<ll,ll> #define mp make_pair #define fi first #define se second #define vv vector #define rep(i,n) rep2...
C++
d9eb0f6f82bd09ea53a1dbbd7242c497
97b5cb06b655f6dadb5a522c960fa9a9
2,100
PASSED
//template by murugappan....Copied from chamow :p #include<bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define x first #define y second #define pb push_back #define mp make_pair #define priq(i,comp) priority_queue( i, vector< i >,comp) template<class t> t lcm(t a,t b) { return ...
C++
d9eb0f6f82bd09ea53a1dbbd7242c497
7fcb30bba13a72c833c1c2e32377c1e7
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define f first #define s second #define point complex <ld> #define length(a) (hypot((a).imag() , (a).real())) #define cross(a,b) ( (conj(a)*(b)).imag() ) ld pi = acos(-1) , eps = 1e-14; ll n,m; vector<point> v , v2; int dcmp...
C++
d9eb0f6f82bd09ea53a1dbbd7242c497
99899f7a006e9c1f9f8b523f499e28f7
2,100
PASSED
#include<bits/stdc++.h> #include<algorithm> #include<string> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define pi acos(-1.0) #define sf(a) scanf("%lld",&...
C++
d9eb0f6f82bd09ea53a1dbbd7242c497
1ccfe37b7b12f4bd9e81ac97cc87b321
2,100
PASSED
#include<iostream> #include<vector> #include<algorithm> #include<cmath> #include<stack> using namespace std; long long int startnum=1; struct Point { long long int x,y; }point[222222],start; stack<Point>s1,s2; long long int cross_product(Point p0,Point p1,Point p2) { return (p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y...
C++
d9eb0f6f82bd09ea53a1dbbd7242c497
092e45e598ff641456ecf9d1e503f609
2,100
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> using namespace std; int main() { int n, m, s, f; while (scanf("%d%d%d%d", &n, &m, &s, &f) != EOF) { int move = (s > f ? -1 : 1); int current, l, r; int next = 1; current = 0; while (s != f) { ...
C++
c1c9815e2274a1f147eab7bd8ee2d574
f2a1d399c2a56f3988b4cb170fd87b80
1,500
PASSED
#include <cstdio> int main() { int n,m,s,f; char go; int t,l,r; int now=1; int forward; scanf("%d%d%d%d",&n,&m,&s,&f); if(s < f) { go = 'R'; forward = 1; } else { go = 'L'; forward = -1; } for(int i=1;i<=m;++i) { scanf("%d%d...
C++
c1c9815e2274a1f147eab7bd8ee2d574
6d636769eb2139950beb78d7f603fa6a
1,500
PASSED
#include <bits/stdc++.h> #include <ext/hash_map> #include <ext/numeric> using namespace std; using namespace __gnu_cxx; typedef long long ll; typedef unsigned long long ull; void fastInOut(); int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "rt", stdin); #endif fastInOut(); int n, m, s, f; ci...
C++
c1c9815e2274a1f147eab7bd8ee2d574
c4888568b8df162c943d4c1e38c728df
1,500
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int n,m,s,f,a,b,pas; while(scanf("%d%d%d%d",&n,&m,&s,&f)!=EOF){ vector<pair<int,int> >V(100010); int mp=1; string x=""; int qweqwe=0; while(m--){ scanf("%d%d%d",&pas,&a,&b); if(s<f){ ...
C++
c1c9815e2274a1f147eab7bd8ee2d574
8f5e3315d6f783ee7bdff454fee50f4f
1,500
PASSED
/* #include<iostream> #include<algorithm> #include<cstring> using namespace std; int Min(int m,int n,int p) { int t; t=m < n ? m:n ; return t < p ? t:p ; } int main() { int a[10],t,n,i,num,sum,min,min1; while(cin>>n) { memset(a,0,sizeof(a)); for(i=0;i<n;i++) { cin>...
C++
c1c9815e2274a1f147eab7bd8ee2d574
4d19fefafb8b2983d0d8375a375732b7
1,500
PASSED
/* #include<iostream> #include<algorithm> #include<cstring> using namespace std; int Min(int m,int n,int p) { int t; t=m < n ? m:n ; return t < p ? t:p ; } int main() { int a[10],t,n,i,num,sum,min,min1; while(cin>>n) { memset(a,0,sizeof(a)); for(i=0;i<n;i++) { cin>...
C++
c1c9815e2274a1f147eab7bd8ee2d574
b4b6e5504aa8321f24757877b7d51680
1,500
PASSED
#include <iostream> #include <algorithm> #include <set> #include <vector> using namespace std; int tab[5][100005]; int main () { int n, m, cur, des, time=1; cin>>n>>m>>cur>>des; for(int i=1;i<=m;i++) cin>>tab[1][i]>>tab[2][i]>>tab[3][i]; int i=1; do { int watch = t...
C++
c1c9815e2274a1f147eab7bd8ee2d574
a00befe4447c44d4db8e2d2bee4e65d9
1,500
PASSED
#include <cstdio> #include <algorithm> #include <cstring> #include <vector> #include <queue> using namespace std; #define N 100100 int now_step[N],l[N],r[N]; int main() { int n,m,s,t; scanf("%d%d%d%d",&n,&m,&s,&t); int pre_step=0,cur=s,w; if(t<s)w=-1; else w=1; for(int i = 0; i < m; i++) { ...
C++
c1c9815e2274a1f147eab7bd8ee2d574
57fab7797de3349723f41b3f4a146048
1,500
PASSED
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; struct node { int x,y; __int64 t; }kep[100005]; int main() { int n,m,s,f; while(~scanf("%d%d%d%d",&n,&m,&s,&f)) { int flag=0,fg,a,b,t; int time=1; if(s>f) ...
C++
c1c9815e2274a1f147eab7bd8ee2d574
a7bd8c093845dfc0a35946a06970790e
1,500
PASSED
#include <cstdlib> #include <cstdarg> #include <cassert> #include <cctype> // tolower #include <ctime> #include <cmath> #include <iostream> #include <sstream> #include <iomanip> #include <map> #include <set> #include <list> #include <queue> #include <vector> #include <string> #include <limits> #include <utility> #i...
C++
c1c9815e2274a1f147eab7bd8ee2d574
03d697c0857db0214d7d3fee84b7f9da
1,500
PASSED
#include <bits/stdc++.h> using namespace std; int n , k , c; vector<pair<int , int>> v , oper; int main() { cin>>n>>k; for(int i=0 ; i<n ; i++){ int x; cin>>x; v.push_back({x , i+1}); } while(k--){ sort(v.begin() , v.end()); if((v[n-1].first - v[0].first) <= 1) break; else{ v[0].first++; v[n-1]...
C++
9cd42fb28173170a6cfa947cb31ead6d
a41271992ee9d1510018103ecba3e614
1,400
PASSED
#include <iostream> #include <cstdio> #include <queue> #include <utility> #include <vector> using namespace std; typedef pair<int, int> ii; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv) { ios_base::sync_with_stdio(false); cin.tie(...
C++
9cd42fb28173170a6cfa947cb31ead6d
cea59b04e76537fc76841cb82a2b673c
1,400
PASSED
/* * URL : https://codeforces.com/problemset/problem/479/B * DATE : 28th Jan, 2019 */ //___________________________________________________________________________________________________________ #include<bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; typedef long long ll; typedef vector<int> vi...
C++
9cd42fb28173170a6cfa947cb31ead6d
6001cfb5c45c7a894891cd9673794867
1,400
PASSED
/* * URL : https://codeforces.com/problemset/problem/479/B * DATE : 28th Jan, 2019 */ //___________________________________________________________________________________________________________ #include<bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; typedef long long ll; typedef vector<int> vi...
C++
9cd42fb28173170a6cfa947cb31ead6d
881c82608ec131c29a20dfb59fa2e9e9
1,400
PASSED
#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 long long int ll; typedef long double ld; typedef list<int> li; typedef list<list<int>> lli; typedef vector<int> vi; typedef vector<ll> vll; typedef vecto...
C++
9cd42fb28173170a6cfa947cb31ead6d
f0e38cf6084911e8e6171ba14f22f825
1,400
PASSED
#include <bits/stdc++.h> #define ll long long int using namespace std; void hehe() { int n, k; cin >> n >> k; vector<int> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } vector<pair<int, int>> ans; int count = 0; while (count < k) { int a = INT_MAX, b = IN...
C++
9cd42fb28173170a6cfa947cb31ead6d
042873d18a924ae45718387188e575e9
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long int #define ld long double #define pb push_back #define mkp make_pair #define pii pair<int, int> #define pll pair<long long int, long long int> #define sci(x) scanf("%d", &x) #define scl(x) scanf("%lld", &x) #define fi first #d...
C++
9cd42fb28173170a6cfa947cb31ead6d
8d3b5dbecbf23a9d938a68d7ed628d8a
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long int #define ld long double #define pb push_back #define mkp make_pair #define pii pair<int, int> #define pll pair<long long int, long long int> #define sci(x) scanf("%d", &x) #define scl(x) scanf("%lld", &x) #define fi first #d...
C++
9cd42fb28173170a6cfa947cb31ead6d
aab07794957685b3f653879e2376cf7e
1,400
PASSED
#pragma GCC optimize("Ofast") #include<iostream> #include<bits/stdc++.h> #include<math.h> #include<stdlib.h> #include<vector> #include<algorithm> #include<map> #include<set> #include<string> #include<unordered_set> #include<unordered_map> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp>...
C++
9cd42fb28173170a6cfa947cb31ead6d
fb6e11a8a9a8848cf4cb00c75c00b1ab
1,400
PASSED
#include <cstdio> #include <vector> #include <algorithm> int main(){ long n, k; scanf("%ld %ld\n", &n, &k); std::vector<std::pair<long, long> > heightVec(n); for(int p = 0; p < n; p++){ long temp; scanf("%ld", &temp); heightVec[p].first = temp; heightVec[p].second = p + 1; } std:...
C++
9cd42fb28173170a6cfa947cb31ead6d
508076bce46bfe7c4d3b6cec240cd39f
1,400
PASSED
#include<iostream> #include<string> #include<sstream> #include<algorithm> #include<vector> #include<map> #include<bitset> #include<queue> #include<stack> #include<set> using namespace std; #define ll long long set<int>s; int main() { int n, m; cin >> n >> m; map<string, string>mp; while (m--) { string a, b; ...
C++
edd556d60de89587f1b8daa893538530
c94aab7590b531df1efcb2da50375deb
1,000
PASSED
#include <iostream> #include <string> #include <map> using namespace std; int main () { map <string, string> mp; int n, m; string first, second, str; cin >> n >> m; for (int i=0; i<m; i++) { cin >> first >> second; mp[first]=second; } for (int i=...
C++
edd556d60de89587f1b8daa893538530
bfbbf08bf234953693949492fb359778
1,000
PASSED
#include<iostream> #include<string> #include<vector> #include<queue> #include<stack> #include<map> #include<algorithm> #define P push #define all(v) #define F front() #define rb rbegin() #define re rend() #define b back() #define B begin() #define E end() #define PB push_back #define S size() const int length=6 ; usi...
C++
edd556d60de89587f1b8daa893538530
4caec733e0dc0a2db59942a143fde90e
1,000
PASSED
#include <string> #include <iostream> #include <map> using namespace std; int main() { int n,m; cin>>n>>m; map<string,string>mp; string s,g; for(int i=0;i<m;i++){ cin>>s>>g; mp[s]=g; } for(int i=0;i<n;i++){ cin>>s; if(s.length()>mp[s].length()) co...
C++
edd556d60de89587f1b8daa893538530
164b46c84d839669b00f3e7291bad3ca
1,000
PASSED
#include <iostream> #include <string> #include <map> #include <list> using namespace std; string run[3006]; int main() { map<string, string> mp; string a, b; int n, m; cin >> n >> m; for(int y=0; y<m; y++) { cin >> a >> b; mp[a]=b; } for(int y=0; y<n; y++) { cin >> ru...
C++
edd556d60de89587f1b8daa893538530
1fb26fd7829fdbf67ecb9f1a334b8173
1,000
PASSED
#include <iostream> #include<string> using namespace std; int main() { int n,m; cin>>n>>m; string *x= new string[m]; string *y= new string[m]; for(int i=0;i<m;i++) cin>>x[i]>>y[i]; string *s=new string[n]; for(int i=0;i<n;i++) cin>>s[i]; for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { if(s[i]==x[j]) ...
C++
edd556d60de89587f1b8daa893538530
7b79246ec9c5e5c1f61b56985c015f17
1,000
PASSED
#include <iostream> #include <string> #include <vector> #include <map> std::ostream& operator<<(std::ostream& stream, const std::vector <std::string>& v_str) { for (size_t i = 0; i < v_str.size(); i++) { stream << v_str[i] << " "; } return stream; } int main() { size_t n, m; std::cin >> n >> m; std::map<std:...
C++
edd556d60de89587f1b8daa893538530
ee306d05bbb9e65d2cc61258ffc39da5
1,000
PASSED
#include <iostream> #include <string> #include <vector> #include <map> int main() { size_t n, m; std::cin >> n >> m; std::map<std::string, std::string> word_map; std::vector<std::string> text(n); for (int i = 0; i < m; i++) { std::string word_first, word_second; std::cin >> word_first >> word_second; word...
C++
edd556d60de89587f1b8daa893538530
3eeacd3f20ca5e6c394855224534decf
1,000
PASSED
#include <iostream> #include <map> #include <string> #include <vector> #include <algorithm> #include <cmath> using namespace std; void solve(){ int n, m; cin >> n >> m; map<string, string> mp; for(int i=0; i<m; i++){ string a, b; cin >> a >> b; mp[a]=b; } for(int i=0;...
C++
edd556d60de89587f1b8daa893538530
36d281ced26091112ca2ee35f1a4d986
1,000
PASSED
// //#include <iostream> //using namespace std; // //int lol[1001]; // //void main() //{ // int s,n,z=0;//st[0] = s // int st[1001], po[1001]; // cin >> s >> n; // // for (int i = 1; i <= n; i++) // { // cin >> st[i] >> po[i]; // } // // for (int i = 1; i <= n; i++) // { // if ((s > st[i]) && (lol[i] == 0)) // {...
C++
edd556d60de89587f1b8daa893538530
37eadd069452797abed8ca8d69b43767
1,000
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; int n; int root; vector<int> edges[MAXN]; multiset<int> parent, children, outer; int siz[MAXN], maxson[MAXN]; bool big[MAXN]; int ans[MAXN]; void prefuck(int x) { siz[x] = 1; ans[x] = n - 1; for (auto nex : edges[x]) { prefuck(nex); siz[x...
C++
88f297c1e741c8c5f1c0e9ae39722cac
3c8791e9eea077615051ff1dbb753cf3
3,300
PASSED