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; 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
f34b0a966db7e368016fd5a4503319b0
3,300
PASSED
#include<bits/stdc++.h> #define pb push_back using namespace std; const int N = 1e5 + 73; int n, root, sz[N], Ptr[N], MN[N], MX[N], R[N]; vector < int > Adj[N]; set < int > S[N]; multiset < int > P, A; void Del(multiset < int > &SS, int val) { auto it = SS.lower_bound(val); if (it != SS.end() && (*it) == val) ...
C++
88f297c1e741c8c5f1c0e9ae39722cac
af1c4b0aa99484d3f27d3f82bab790e6
3,300
PASSED
#include<iostream> #include<cmath> #include<cstdio> #include<algorithm> #include<cstring> #include<vector> using namespace std; struct bian{ int next,point; }b[110000]; int p[110000],len,n,ro; struct tree{ int l,r,size; }t[8000000]; int root[110000],size[110000],dfs[110000],rr[110000],sign,x[110000]; int ans[110000];...
C++
88f297c1e741c8c5f1c0e9ae39722cac
5b902aab4afbc8edb467e4f0a45d50a9
3,300
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <iostream> #include <cassert> #include <cstdio> #include <vector> #include <set> using namespace std; vector <int> g[100010]; int sz[100010], n, minsz[100010]; void HLD(int x) { int i, mx = 0, j = -1, mn = 1e9, l = -1; sz[x] = 1; for (i = 0; i < g[x].size...
C++
88f297c1e741c8c5f1c0e9ae39722cac
ea61e8f25c963c92d2dca8a5c19d0741
3,300
PASSED
#include<bits/stdc++.h> #define re register #define inc(i,j,k) for(re int i=j;i<=k;i++) #define edge(u) for(re int i=head[u];i;i=e[i].nxt) #define IT multiset<int>::iterator using namespace std; const int N=1e5+5; inline int read(){ int x=0; char ch=getchar(); while(ch<'0'||ch>'9') ch=getchar(); while('0'<=ch&&ch<=...
C++
88f297c1e741c8c5f1c0e9ae39722cac
b4f0d87f2a2fd0040dfb580233fcaf7f
3,300
PASSED
#ifdef DEBUG #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> using namespace std; typedef long double ld; #ifdef DEBUG #define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr) #else #define eprintf(...) ; #endif #define sz(x) ((int) (x).size()) #define TASK "text" const int inf = (int) 1.01e9; con...
C++
88f297c1e741c8c5f1c0e9ae39722cac
c3dbca50c6095ad317e4945f7e28c267
3,300
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back const int N = 1e5 + 5; vector<int> g[N]; map<int, int> mp[2], p;//p : u to root. mp[0] : out of p. mp[1] : son int root, n, ans[N], sz[N]; bool big[N]; void dfs(int u) { sz[u] = 1, ans[u] = n - 1; for (auto v : g[u]) { dfs(v); sz[u] += sz[v]; } ...
C++
88f297c1e741c8c5f1c0e9ae39722cac
00379fdd565bac0b91738e817605af5b
3,300
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back const int N = 1e5 + 5; vector<int> g[N]; map<int, int> mp[2], p;//p : u to root. mp[0] : out of p. mp[1] : son int root, n, ans[N], sz[N]; bool big[N]; void dfs(int u) { sz[u] = 1, ans[u] = n - 1; for (auto v : g[u]) { dfs(v); sz[u] += sz[v]; } ...
C++
88f297c1e741c8c5f1c0e9ae39722cac
0bfbfae02d33a5e7502a7af122d1fb4a
3,300
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 100005; vector<int> adj[N]; int sz[N], ans[N]; int n, root; bool big[N]; map<int,int> mp, mpo, par; void getsz(int s){ sz[s] = 1; ans[s] = n - 1; for(auto it : adj[s]){ getsz(it); sz[s] += sz[it]; } mpo[sz[s]]++; } void b...
C++
88f297c1e741c8c5f1c0e9ae39722cac
8ab7211b4d8f2f7dc795f8cd5efd6a72
3,300
PASSED
#pragma region Macros #pragma GCC optimize("O3") #pragma GCC target("avx2,avx") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #define ll long long #define ld long double #define rep2(i, a, b) for(ll i = a; i <= b; ++i) #define rep(i, n) for(ll i = 0; i < n; ++i) #define rep3(i, a, b) for(ll i = a; i >= ...
C++
7f15864d46f09ea6f117929565ccb867
3c0f99b32f6f867cd6ca0800fa9d2876
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e6 + 42; int timer; vector<int> tin(MAXN), tout(MAXN), vin(2*MAXN); vector<int> g[MAXN]; int dfs(int v, int p = 0) { tin[v] = ++timer; vin[tin[v]] = v; for(int to : g[v]) if(to != p) { dfs(to, v); } tout[v] = ++timer; } vector<pair<int, i...
C++
7f15864d46f09ea6f117929565ccb867
40c0a643fb8df2809be3c75630f2003d
1,900
PASSED
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author alireza_kaviani */ #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; template<class T> using Tree = tree<T, null_t...
C++
7f15864d46f09ea6f117929565ccb867
3575d192862590e3e9bc8f07465c21a7
1,900
PASSED
#include <bits/stdc++.h> #include <unordered_map> using namespace std; #define maxn 300010 #define ios cin.tie(0) ,cout.tie(0), cout.sync_with_stdio(0) typedef long long ll; struct edge{ int v,nxt; }e[maxn]; int head[maxn],en; int hs[maxn],sz[maxn],kp[maxn]; int fa[maxn]; void init(){ en=0;memset(head,-1,sizeof(head)...
C++
7f15864d46f09ea6f117929565ccb867
d45da5a5a05e76d1eb5a7c50829e41e5
1,900
PASSED
// clion is being dumb #include <iostream> #include <string> #include <vector> #include <algorithm> #include <sstream> #include <queue> #include <deque> #include <bitset> #include <iterator> #include <list> #include <stack> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <functi...
C++
7f15864d46f09ea6f117929565ccb867
8c82e08783f1eb37d18449cb097289bd
1,900
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define all(v) (v).begin() , (v).end() #define popcnt(x) __builtin_popcount(x) #define inf 0x3f3f3f3f #define watch(x) cout << (#x) << " is " << (x) << endl #define rand() (rand() << 15 | rand()) ...
C++
7f15864d46f09ea6f117929565ccb867
9a4f304f26a9d005f786aea566c7adec
1,900
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define all(v) (v).begin() , (v).end() #define popcnt(x) __builtin_popcount(x) #define inf 0x3f3f3f3f #define watch(x) cout << (#x) << " is " << (x) << endl #define rand() (rand() << 15 | rand()) ...
C++
7f15864d46f09ea6f117929565ccb867
422a9f5659fb7416b4f906cca620f789
1,900
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define all(v) (v).begin() , (v).end() #define popcnt(x) __builtin_popcount(x) #define inf 0x3f3f3f3f #define watch(x) cout << (#x) << " is " << (x) << endl #define rand() (rand() << 15 | rand()) ...
C++
7f15864d46f09ea6f117929565ccb867
ac8051a339055996e2695740d7f71101
1,900
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define all(v) (v).begin() , (v).end() #define popcnt(x) __builtin_popcount(x) #define inf 0x3f3f3f3f #define watch(x) cout << (#x) << " is " << (x) << endl #define rand() (rand() << 15 | rand()) ...
C++
7f15864d46f09ea6f117929565ccb867
c0af450366358e99313cf62c3bad802a
1,900
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n, q; const int N = 600001; int nxt[N], first[N], go[N], tot, sz[N], f[N], ans[N], fa[N]; void add(int x, int y) { nxt[++tot] = first[x]; first[x] = tot; go[tot] = y; } void dfs(int x) { ans[x] = x; sz[x] = 1; int ...
C++
7f15864d46f09ea6f117929565ccb867
ea1d83fd3fe87f8ac0a5d6e4d814ff34
1,900
PASSED
#include<bits/stdc++.h> using namespace std; long long mod=998244353; long long pwr(long long a, long long b){ if(b==0){ return 1; } long long p = pwr(a,b/2); p= (p*p)%mod; if(b%2!=0){ p = (p*a)%mod; } return p; } int main(){ long long n,m; cin>>n>>m; string a...
C++
d2fe5a201d1ec20c5b32cd99b54e13d0
e6dba772409675894b74eaf39cf12c51
1,700
PASSED
#include<bits/stdc++.h> using namespace std; long long mod=998244353; long long pwr(long long a, long long b){ if(b==0){ return 1; } long long p = pwr(a,b/2); p= (p*p)%mod; if(b%2!=0){ p = (p*a)%mod; } return p; } int main(){ long long n,m; cin>>n>>m; string a...
C++
d2fe5a201d1ec20c5b32cd99b54e13d0
115d5c240c0dd19235f460f499470bd8
1,700
PASSED
#include<bits/stdc++.h> using namespace std; long long mod=998244353; long long pwr(long long a, long long b){ if(b==0){ return 1; } long long p = pwr(a,b/2); p= (p*p)%mod; if(b%2!=0){ p = (p*a)%mod; } return p; } int main(){ long long n,m; cin>>n>>m; string a...
C++
d2fe5a201d1ec20c5b32cd99b54e13d0
89017c3f6219095c508f13804d2c92d9
1,700
PASSED
#include<bits/stdc++.h> using namespace std; long long mod=998244353; long long pwr(long long a, long long b){ if(b==0){ return 1; } long long p = pwr(a,b/2); p= (p*p)%mod; if(b%2!=0){ p = (p*a)%mod; } return p; } int main(){ long long n,m; cin>>n>>m; string a...
C++
d2fe5a201d1ec20c5b32cd99b54e13d0
02bd3398c8718a8f7dc5e0c55f3f9bef
1,700
PASSED
#include<bits/stdc++.h> using namespace std; long long mod=998244353; long long pwr(long long a, long long b){ if(b==0){ return 1; } long long p = pwr(a,b/2); p= (p*p)%mod; if(b%2!=0){ p = (p*a)%mod; } return p; } int main(){ long long n,m; cin>>n>>m; string a...
C++
d2fe5a201d1ec20c5b32cd99b54e13d0
592b3b5a6d56504fc2d08c91098902cb
1,700
PASSED
#include<bits/stdc++.h> using namespace std; long long mod=998244353; long long pwr(long long a, long long b){ if(b==0){ return 1; } long long p = pwr(a,b/2); p= (p*p)%mod; if(b%2!=0){ p = (p*a)%mod; } return p; } int main(){ long long n,m; cin>>n>>m; string a...
C++
d2fe5a201d1ec20c5b32cd99b54e13d0
9ab9a3dd9bf9a52c3ad38d393ed3e266
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define loop(a, b, inc) for (int i = a; i <= b; i += inc) typedef pair<int, int> pii; typedef pair<int, string> ps; typedef unsigned long long int llu; typedef long long int ll; const int MOD = 998244353, MAXN = 1e6; int main() { ios::sync_with_stdio(...
C++
d2fe5a201d1ec20c5b32cd99b54e13d0
5c4a0da427a6a48086c39a4163082f72
1,700
PASSED
#include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long ans=0,sum=0,m,n,i,j=1; string a,b; cin>>m>>n>>a>>b; while(n){ if(m){ if(a[m-1]=='1'){ sum=(j+sum)%998244353; } m--; } if...
C++
d2fe5a201d1ec20c5b32cd99b54e13d0
0a072714a542c2efd6ddb6a5692b9a59
1,700
PASSED
#include <iostream> using namespace std; int main() { long long ans=0,sum=0,m,n,i,j=1; string a,b; cin>>m>>n>>a>>b; while(n){ if(m){ if(a[m-1]=='1'){ sum=(j+sum)%998244353; } m--; } if(b[n-1]=='1'){ ans=(sum+ans)%998244353; ...
C++
d2fe5a201d1ec20c5b32cd99b54e13d0
9e116615ec91ca2a2f9813614553aaa3
1,700
PASSED
#include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long ans=0,sum=0,m,n,i,j=1,k=998244353; string a,b; cin>>m>>n>>a>>b; while(n){ if(m){ if(a[m-1]=='1'){ sum+=j; if(sum>=k){ sum%=k...
C++
d2fe5a201d1ec20c5b32cd99b54e13d0
7bb29aedf54db9345997d157d72b9d7b
1,700
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<cmath> #define int long long #define double long long using namespace std; const int MXN=120; struct rec{ int a,b; }t[MXN]; int n; inline int read(){ int X=0,z=0;char ch=0; while(!isdigit(ch)) z=ch=='-'?1:0,ch=getchar...
C++
8883f8124092ace99ce0309fb8a511aa
ad2fd6e394dc595783f3d82cee40dc57
2,500
PASSED
#include <bits/stdc++.h> using namespace std; int n, in; vector<long long> a; vector<int> b; vector<pair<long long, int>> cur; int main() { cin >> n; for(int i = 0; i < (n << 1); i++) { cin >> in; if(i < n) a.push_back(in); else b.push_back(in); } if(a[0] == 99999991) { cout << 1289043070; ...
C++
8883f8124092ace99ce0309fb8a511aa
708c73578d3604ccd4fedccfab3c53a9
2,500
PASSED
#include <bits/stdc++.h> using namespace std; int n, in; vector<long long> a; vector<int> b; vector<pair<long long, int>> cur; int main() { cin >> n; for(int i = 0; i < (n << 1); i++) { cin >> in; if(i < n) a.push_back(in); else b.push_back(in); } for(int i = 0; i < n; i++) a[i] *= 1000; for(in...
C++
8883f8124092ace99ce0309fb8a511aa
9d98cbc586056d3be17e1ff64c0719fb
2,500
PASSED
#include <bits/stdc++.h> using namespace std; int n, in; vector<long long> a; vector<int> b; vector<pair<long long, int>> cur; int main() { cin >> n; for(int i = 0; i < (n << 1); i++) { cin >> in; if(i < n) a.push_back(in); else b.push_back(in); } if(a[0] == 99999991) { cout << 1289043070; ...
C++
8883f8124092ace99ce0309fb8a511aa
0311e9ef1cefd391a48abf19f5ef3482
2,500
PASSED
// __________________ // | ________________ | // || ____ || // || /\ | || // || /__\ | || // || / \ |____ || // ||________________|| // |__________________| // \###################\ // \###################\ // \ ____ \ // \_______\___\_______\ // An AC a ...
C++
8883f8124092ace99ce0309fb8a511aa
3c0aa863ee0612b496094ea3e651d018
2,500
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <cmath> #include <cstdio> #include <queue> #include <deque> #include <bitset> #include <set> #include <unordered_set> #include <map> #include <unordered_map> #include <random> #include <ctime> #include <utility> #include <fstream> #p...
C++
8883f8124092ace99ce0309fb8a511aa
9f255aa9b3056dd4777ec57b8e7e9212
2,500
PASSED
/** * Sources: various */ #pragma GCC optimize("O3") #pragma GCC target("sse4") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<ll, vector<ll>> element; #define FOR(i, a, b) for (int i=a; i<(b); i++) #d...
C++
8883f8124092ace99ce0309fb8a511aa
313b01e0c2a4d655b71d5512ba0eb0bc
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int64_t I = 1e18; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<array<int, 2>> tasks(n); for (int i = 0; i < 2; ++i) { for (auto& j : tasks) { cin >> j[i]; } } sort(tasks.rbegin(), tasks.rend...
C++
8883f8124092ace99ce0309fb8a511aa
ac8e7f932f4b22942f99b035df1c3a66
2,500
PASSED
#include <bits/stdc++.h> #define int int64_t #define double long double using namespace std; const double eps = 1e-5, inf = 1e15; signed main() { //freopen("input.txt", "r", stdin); ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int a[n], b[n]; for(int i = 0; i < n; i++) { c...
C++
8883f8124092ace99ce0309fb8a511aa
4b041376e49aa51d6ea3885d2d026016
2,500
PASSED
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <str...
C++
8883f8124092ace99ce0309fb8a511aa
862ee2d5297277e955b00bb37627e1b5
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector <pair<int,int>> ans; int main() { int t; cin >> t; while(t--){ int b,w; cin >> b >> w; bool flag = false; if(w==b){ cout <<"YES"<<endl; for(int i = 1 ; i <= w+b ; i++)cout<<"1...
C++
92dff52c8f02d500de9fef6f2095b0bd
ff211965e1b75c78d1f659b1bee29108
1,800
PASSED
#include <bits/stdc++.h> #include <time.h> #include <stdlib.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define ull unsigned long long #define gcd(a,b) __gcd((a),(b)) #define l...
C++
92dff52c8f02d500de9fef6f2095b0bd
9be4d417f70952e4e707fd0537390fb8
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #include<ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; #define ll long long template<class T> ostream& operator<<(ostream &os,vector<T> V){ os<<"[ ";for(auto v:V)os<<v<<" ";return os<<" ]"; } template<class L,class R> ostream& operator<<(ostream &os,pair<L,R> ...
C++
92dff52c8f02d500de9fef6f2095b0bd
b4f4d60d75cf451e682a024104746994
1,800
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; #define F first #define S second #define endl "\n" #define pb push_back #define mp make_pair // typedef long long int; typedef long long ll; typedef unsigned long lon...
C++
92dff52c8f02d500de9fef6f2095b0bd
ee3d81de5af65ba16a1165744a165d4b
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define pb push_back #define sz(c) (int)c.size() #define len(c) (int)c.length() #define vec vector #define int l...
C++
92dff52c8f02d500de9fef6f2095b0bd
f7778fc671757b42cb3ead7478832f26
1,800
PASSED
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define pf push_front #define popb pop_back #define popf pop_front #define srt(v) sort(v.begin(),v.end()) #define srtg(v,ll) sort(v.begin(),v.end(),greater<ll>()) #define lb(a,v) lower_bound(v.begin(),v.end(),a) #define ub(a,v) upper_bound(v.begin(),v.e...
C++
92dff52c8f02d500de9fef6f2095b0bd
8d0299e33d52885da15214f1c46a6bfb
1,800
PASSED
#include <iostream> #include <algorithm> #include <cstring> #include <memory.h> #include <math.h> #include <vector> #include <map> #include <set> #include <unordered_set> #include <unordered_map> #include <stdio.h> #include <queue> #include <stack> #include <cstdio> #include <bitset> using namespace std; #define nfs ...
C++
92dff52c8f02d500de9fef6f2095b0bd
a635285aa062dd995527ba6ee0454a6c
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define LOCAL_PROJECTx #ifndef LOCAL_PROJECT #define debug(x) #define debuga(a, n) #define debug2(x, y) #define debug3(x, y, z) #define debug4(x, y, z, w) #else #define debug(x) {cerr <<#x<<" = " <<x<<"\n"; } #define debuga(a, n) {cerr << #a << " = "; fo...
C++
92dff52c8f02d500de9fef6f2095b0bd
c29a65bac7094c7297302fb74fcc589a
1,800
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<cstring> #include<string> #include<stack> #include<queue> #include<deque> #include<set> #include<vector> #include<map> #include<unordered_map> #define fst first #define sc second #define pb push_back #define mem(a,b) memset(a,b,sizeof(a)...
C++
92dff52c8f02d500de9fef6f2095b0bd
bce0441f4ec03a990a5851aa7a705169
1,800
PASSED
#include<bits/stdc++.h> using namespace std; void swp(int *x,int *y){ int t=*x; *x=*y; *y=t; } int main(){ int q,b,w,b1,b2,b3,b4,w1,w2,i,x1; cin>>q; while(q--){ cin>>b>>w; bool swp1=false; if(b<w){ swp(&b,&w); swp1=true; } if(b>(w*3+1)){ cout<<"NO"<<endl; continue; } vector< pair<in...
C++
92dff52c8f02d500de9fef6f2095b0bd
83a6baca8d5f605787b24113a4352d31
1,800
PASSED
#pragma comment(linker,"/STACK:102400000,102400000") #include<iostream> #include<vector> #include<algorithm> #include<cmath> #include<string> #include<stack> #include<cstdio> #include<queue> #include<map> #include<set> #include<time.h> #include<cstdlib> #include<list> #include<cstring> #include<iterator> using namespac...
C++
ac718922461f3187d8b7587c360b05fc
fd2c136a3b5b3336f43a1976da4ff617
1,300
PASSED
#include <iostream> #include <vector> #include <string> #include <map> #include <algorithm> #include <queue> #include <stdio.h> #pragma warning (disable:4996) using namespace std; vector<long long> v; int main() { #ifdef _DEBUG freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif l...
C++
ac718922461f3187d8b7587c360b05fc
a2d6220ebcfba28860db76945dc814c2
1,300
PASSED
#define DEBUG 0 #include <algorithm> #include <functional> #include <numeric> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <complex> #include <cstdlib> #include <ctime> #include <cstring> #include <cassert> #include <string> #include <vector> #include <list> #include <map> #includ...
C++
ac718922461f3187d8b7587c360b05fc
4697c7eca5e650f29087231c69eb9b1d
1,300
PASSED
n, m = map(int, input().split()) st = [] for i in range(n): s = input() x = set() for j in range(m): if s[j] == '#': x.add(j) for i in st: if len(i & x) > 0 and i != x: print('No') exit() st.append(x) print('Yes')
Python
ac718922461f3187d8b7587c360b05fc
456f652ae22c55dd276ad82785506675
1,300
PASSED
n, m = map(int, input().split()) L = [] for i in range(n): line = input() x = set() for j in range(m): if line[j] == '#': x.add(j) for o in L: if o & x and o != x: print('No') exit(0) L.append(x) print('Yes')
Python
ac718922461f3187d8b7587c360b05fc
ff8084736d8b32a82dce3b4b6c376eef
1,300
PASSED
t=set(input()for _ in [0]*int(input().split()[0])) print(['No','Yes'][all(sum(c<'.'for c in s)<2for s in zip(*t))]) # Made By Mostafa_Khaled
Python
ac718922461f3187d8b7587c360b05fc
379eae218bff808ab66e5d7f1c7741d6
1,300
PASSED
n, m = map(int, input().split()) xr = [list(input()) for _ in range(n)] xc = [list(col) for col in zip(*xr)] def toIndexList(z): return [i for i,v in enumerate(z) if v == '#'] yr = list(map(toIndexList, xr)) yc = list(map(toIndexList, xc)) zr = [i for i,v in enumerate(yr) if v] zc = [i for i,v in enumerate(y...
Python
ac718922461f3187d8b7587c360b05fc
6376d8e7dbfb04926c225496c8cd0f71
1,300
PASSED
n, m = map(int, raw_input().split()) a = [raw_input().strip() for _ in xrange(n)] par = range(n + m) mk = [0] * (n + m) def find(x): if x == par[x]: return x par[x] = find(par[x]) return par[x] for i, r in enumerate(a): for j, c in enumerate(r): if c == '#': par[find(j+n)] = ...
Python
ac718922461f3187d8b7587c360b05fc
826dbe997595c3959803d73b98bbe4ad
1,300
PASSED
n,m=[int(k) for k in raw_input().split(" ")] ds=[] cols=[0]*m rows=[0]*n pow2=[1] for k in range(1,51): pow2+=[pow2[-1]*2] for i in range(n): ds+=[raw_input()] for j in range(m): if ds[i][j]=="#": cols[j]+=pow2[i] d=set() tc=0 res="Yes" for c in cols: if c not in d: if tc&c!...
Python
ac718922461f3187d8b7587c360b05fc
b7a9824cd4ab10dee6638e0183688908
1,300
PASSED
n,m=map(int,raw_input().split()) a=[] arr={} vis={} for i in range(n): arr[i]=[] for i in range(n): a.append(list(raw_input())) for i in range(n): for j in range(m): if a[i][j]=='#': arr[i].append(j) for i in range(n): for j in range(i+1,n): if arr[i]==arr[j] or (len(arr[i])...
Python
ac718922461f3187d8b7587c360b05fc
bc7efeb8873821e1f54a8133fc927b4c
1,300
PASSED
#include <bits/stdc++.h> #define lowbit(x) (x & -x) #define jh(x, y) x ^= y ^= x ^= y #define loc(x, y) (x - 1) * m + y #define rg register #define inl inline #define PI 3.141592654 typedef long long ll; const int N = 6e5 + 5, INF = 0x3f3f3f3f, mod = 998244353; using namespace std; namespace fast_IO { inl ll read() { ...
C++
8c2e0cd780cf9390e933e28e57643cba
eac8058e117b251507d32d60496602e5
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define mod 1000000007 #define For(i,n) for(int i=0;i<n;i++) #define Fre(i,a,b) for(int i = a; i < b; i++) #define sf(n) scanf("%d", &n) #define sff(a,b) scanf("%d %d", &a, &b) #define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c) #defi...
C++
8c2e0cd780cf9390e933e28e57643cba
aa7cdb6a71245499fcbb3f0cb384e8aa
1,900
PASSED
#include<cstdio> #include<set> #define N 1010 using namespace std; const int INF = 0x3f3f3f3f; int n,i,j,k,p,c,x[N],y[N],l[N*(N-1)/2][4]; struct Line{ double k,b; }; class LineSort{ public: bool operator()(const Line &a,const Line &b){ return (a.k<b.k||a.k==b.k&&a.b<b.b); } }; ...
C++
8c2e0cd780cf9390e933e28e57643cba
8fc8a008c05be402ccd3a55051e65687
1,900
PASSED
#include<cstdio> #include<map> #include<set> #define N 1010 using namespace std; const int INF = 0x3f3f3f3f; int n,i,j,p,c,x[N],y[N],l[N*(N-1)/2][4]; double k,b; struct Line{ double k,b; }; class LineSort{ public: bool operator()(const Line &a,const Line &b){ return (a.k<b.k||a.k==b.k&&a...
C++
8c2e0cd780cf9390e933e28e57643cba
bcac308ea44b375b5d0637ac4574ee29
1,900
PASSED
#include<cstdio> #include<set> #define N 60 using namespace std; int n,i,j,k,p,c,x[N],y[N],l[N*(N-1)/2][4]; int main(){ scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d %d",&x[i],&y[i]); } for(i=1;i<=n;i++){ for(j=i+1;j<=n;j++){ int ka = y[j]-y[i]; int kb = x...
C++
8c2e0cd780cf9390e933e28e57643cba
2770da7312388a52b43d6effb4c7be69
1,900
PASSED
#include<cstdio> #include<set> #define N 1010 using namespace std; const int INF = 0x3f3f3f3f; int n,i,j,k,p,c,x[N],y[N],l[N*(N-1)/2][4]; struct Line{ double k,b; }; class LineSort{ public: bool operator()(const Line &a,const Line &b){ return (a.k<b.k||a.k==b.k&&a.b<b.b); } }; ...
C++
8c2e0cd780cf9390e933e28e57643cba
255beef5d88c35d99eef53b645901afd
1,900
PASSED
#include<cstdio> #include<set> #define N 1010 using namespace std; const int INF = 0x3f3f3f3f; int n,i,j,k,p,c,x[N],y[N],l[N*(N-1)/2][4]; struct Line{ double k,b; }; class LineSort{ public: bool operator()(const Line &a,const Line &b){ return (a.k<b.k||a.k==b.k&&a.b<b.b); } }; ...
C++
8c2e0cd780cf9390e933e28e57643cba
1b589f0fc97d2dfdeeccafedc4338465
1,900
PASSED
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse2") using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> typedef long long int lld; typedef vector<lld> vi; typedef pair<lld,lld> pi; #define F first #define S...
C++
8c2e0cd780cf9390e933e28e57643cba
57d09513e68ae3f66ce188bd326cf9ee
1,900
PASSED
#include <iostream> #include <map> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } int main() { int n; cin >> n; vector<pair<int, int>> points(n); for (int i = 0; i < points.size(); ++i) { ...
C++
8c2e0cd780cf9390e933e28e57643cba
cf6e4b6076ab8c565f6ebc963ff8e3ad
1,900
PASSED
#include<bits/stdc++.h> using namespace std; struct point{ int x; int y; }a[2000]; struct line{ point a; point b; }; map<point,set<long long>>ma; bool operator<(point a,point b){ if(a.x!=b.x)return a.x<b.x; return a.y<b.y; } point operator-(point a,point b){ return {a.x-b.x,a.y-b.y}; } void ...
C++
8c2e0cd780cf9390e933e28e57643cba
ae8b1bd00fb24349c887f9c49ac813fa
1,900
PASSED
// but i bet you if they only knew . . . // they'd just be jealous of us :-) //include <bits/stdc++.h> #include <iostream> #include <algorithm> #include <cstdlib> #include <cmath> #include <stdio.h> #include <cstdio> #include <cstring> #include <string.h> #include <string> #include <set> #include <vector...
C++
77e2a6ba510987ed514fed3bd547b5ab
82c6345ab8643e24f7ef72f35c541042
1,100
PASSED
#include <iostream> #include <string> #include <algorithm> using namespace std; void solve(string a) { int n = a.length(); if(n > 0) { int itemp = 0, max = 0; for(int i = 0; i < n; i++) { if(a[i] >= max){ max = a[i]; itemp = i; } ...
C++
77e2a6ba510987ed514fed3bd547b5ab
794986ac7c9925c66a870c9075fdb18b
1,100
PASSED
#include <cstdio> #include <algorithm> #include <cstring> using namespace std; int a[30]; char s[100005]; int main() { int n,j=0; memset(a,0,sizeof(a)); scanf("%s",s); n=strlen(s); for(int i=0;i<n;i++) a[s[i]-'a']++; for(int i=25;i>=0;i--) { while(a[i]&&j<n) { if...
C++
77e2a6ba510987ed514fed3bd547b5ab
672b6e11af781a6e7034cf350722ab56
1,100
PASSED
#include <bits/stdc++.h> using namespace std; string s, ans; int main() { cin >> s; int cur = 0; for(int i = 122; i > 96; i --) { for(int j = cur ; j < s.size(); j ++) if( s[j] == i ) { ans += s[j]; cur = j; } } cout ...
C++
77e2a6ba510987ed514fed3bd547b5ab
9d615f3b637f6c8f168411a5a238dc91
1,100
PASSED
/* Have courage and be kind*/ #include<bits/stdc++.h> #include<stdlib.h> #include <assert.h> //assert ( n >= 1 && n < 100005 ); using namespace std; #define inf 2147383647LL #define SET(a) memset(a,-1,sizeof(a)) #define all(a) a.begin(),a.end() #define CLR(a) memset(a,0,sizeof(a)) #define PB push_back #define MP make_...
C++
77e2a6ba510987ed514fed3bd547b5ab
1375d15420a80d32ee7dc248d7c94b24
1,100
PASSED
//看看会不会爆int!数组会不会少了一维! //取物问题一定要小心先手胜利的条件 #include <bits/stdc++.h> using namespace std; #pragma comment(linker,"/STACK:102400000,102400000") #define LL long long #define ALL(a) a.begin(), a.end() #define pb push_back #define mk make_pair #define fi first #define se second #define haha printf("haha\n") const int maxn = ...
C++
77e2a6ba510987ed514fed3bd547b5ab
1ce396a62f856b400a77477b78c0fac2
1,100
PASSED
#include <bits/stdc++.h> using namespace std; char s[100005]; struct str{ char c; int idx; }; str arr[100005]; bool comp(str a, str b){ if(a.c==b.c)return a.idx<b.idx; return a.c>b.c; } int main(){ scanf("%s",s); int i; for(i=0;s[i]!='\0';i++){ arr[i].c=s[i]; arr[i].idx=i; ...
C++
77e2a6ba510987ed514fed3bd547b5ab
07e64d046e5528b163580df3d0ee7399
1,100
PASSED
#include <bits/stdc++.h> using namespace std; char b[200000],MAX; int l[40]; string ans; int main() { scanf("%s",b+1); int sz; sz=strlen(b+1); MAX=' '; memset(l,-1,sizeof(l)); for (int i=1;i<=sz;i++) { l[b[i]-'a']=i; if (b[i]>MAX) MAX=b[i]; } // printf("%d\n",l[1]); for (int i=1;i<=sz;i++) { if (b[i...
C++
77e2a6ba510987ed514fed3bd547b5ab
f4d0a90d9415eb109dce38e59ce835ef
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int main() { string s, ans = ""; cin >> s; char c = 'z' + 1; int ind = 0; for (; c >= 'a'; c --) for (int i = ind; i < s.size(); i ++) if (s[i] == c) { ans.push_back(s[i]); ind = i; ...
C++
77e2a6ba510987ed514fed3bd547b5ab
3c8f30df1077aea95299f3414528ccfb
1,100
PASSED
#include <iostream> #include <string> using namespace std; int main() { string s; cin>>s; string c="a"; string sf=""; for(int i=s.size()-1;i>=0;i--) { if(c[0]-s[i]<=0){c=s[i];sf.insert(0,c);} } cout<<sf; return 0; }
C++
77e2a6ba510987ed514fed3bd547b5ab
9e8e32983cdcfbd609ec41829c2e9907
1,100
PASSED
//#include <fsociety> #include <cmath> #include <deque> #include <algorithm> #include <iterator> #include <list> #include <map> #include <unordered_map> #include <queue> #include <set> #include <unordered_set> #include <stack> #include <string> #include <vector> #include <fstream> #include <iostream> #include <iomanip>...
C++
1326553bb07ffcc7bd3eecc7070c5958
9e3abd4c4738686cc30d65b9e0246b60
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define IO \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define sz(x) (int)((x).size()) #define forn(i,n) for (int i=0; i < n; i++) #define forse(i,s,e) for (int i=s; i < e; i++) #define pb push_back #define pf push_front #define r...
C++
1326553bb07ffcc7bd3eecc7070c5958
7ceb6aa18d5ea9a8d1d1ecfdf5398aed
2,000
PASSED
#include<bits/stdc++.h> #define pb push_back #define fr first #define sc second #define all(x) x.begin(), x.end() #define skip continue #define NAME "code" using namespace std; typedef long long ll; typedef long double ld; void faster(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);...
C++
1326553bb07ffcc7bd3eecc7070c5958
cf22828f1304cc6d650d32b1c97c81a3
2,000
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i)) #define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i)) #define mod 998244353 #define xx first #define yy second #define all(a) (a).begin(),...
C++
1326553bb07ffcc7bd3eecc7070c5958
bacdbd0c13fc9416924de31a583e1ff0
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long const ll inf = 2e18; int n, m, k; char s[1005][1005]; int dx[5] = {0,0,1,-1}; int dy[5] = {1,-1,0,0}; ll dis[1005][1005]; queue<pair<int,int>> q; bool valid(int x, int y) { return (1<=x && x<=n && 1<=y && y<=m); } int main() { scanf("%d%d%d",&n,&m,...
C++
1326553bb07ffcc7bd3eecc7070c5958
277ce2a40635834947f87774e2deb2f4
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int #define endl "\n" #define MOD 1000000007 #define INF 0x3f3f3f3f #define pb push_back #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cerr.tie(NULL); \ ...
C++
1326553bb07ffcc7bd3eecc7070c5958
d73d33b6f6f3159d35a0156f61dadd8d
2,000
PASSED
#include <iostream> #include <cstdio> #include <queue> using namespace std; int n,m,a[1005][1005],t,tag[1005][1005],cnt,now,h[1000010],siz[1000010],head,dis[1000010],tot; long long p; string s; queue<int> q; struct edge{ int next,to; } e[8000010]; void add(int u,int v){ ++tot; e[tot].to=v; e[tot].next=h[u]; h[u]=t...
C++
1326553bb07ffcc7bd3eecc7070c5958
e11ac3676813a9d51e41b6881888e54b
2,000
PASSED
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const int N = 1000 + 5, inf = 1e9; #define pb push...
C++
1326553bb07ffcc7bd3eecc7070c5958
bdb6bec1af6fc6c2befa5aff768bdb4b
2,000
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <algorithm> #include <map> #include <set> #include <string> #include <queue> #include <unordered_map> #include <iterator> #include <stack> #include <unordered_set> #include <iomanip> #include <ctime> #include <cstring> #include <bitset> #in...
C++
1326553bb07ffcc7bd3eecc7070c5958
65b736df3a7b819e5343d43fe63b6af6
2,000
PASSED
//#pragma GCC optimize("Ofast") //#pragma GCC target("avx2") #include <iostream> #include <cmath> #include <algorithm> #include <functional> #include <numeric> #include <vector> #include <bitset> #include <deque> #include <queue> #include <set> #include <map> #include <string> #include <random> #include <cassert> usi...
C++
1326553bb07ffcc7bd3eecc7070c5958
7d40f19ec6df5df2888ba3241d6361d7
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 1; struct Edge { int u, v, c, id, nt; Edge(int uu, int vv, int cc, int ii) : u(uu), v(vv), c(cc), id(ii) { } bool operator< (const Edge &rhs) const { if (c == rhs.c) return id < rhs.id; return c < rhs...
C++
f1121338e84c757d1165d1d645bb26ed
f788aa985cc0d26b50b5943c6a96e276
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define sc(x) scanf("%d",&x) const int maxn = 1e5 + 10; const int maxm = 1e5 + 10; const int INF = 0x3f3f3f3f; vector <int> G[maxn]; struct edge { int u,v,c; edge(int u = 0, int v = 0, int c = 0) : u(u), v(v), c(c) {} }es[maxn]; int n,m,u,v,c; int in[maxn]; int top...
C++
f1121338e84c757d1165d1d645bb26ed
bfcf2bb18e1dff179f0598bb7818f866
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define sc(x) scanf("%d",&x) const int maxn = 1e5 + 10; const int maxm = 1e5 + 10; const int INF = 0x3f3f3f3f; vector <int> G[maxn]; struct edge { int u,v,c; edge(int u = 0, int v = 0, int c = 0) : u(u), v(v), c(c) {} }es[maxn]; int n,m,u,v,c; int in[maxn]; int top...
C++
f1121338e84c757d1165d1d645bb26ed
df4d493405b8d7bd8d130f0311385ddb
2,200
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <cassert> using namespace std; struct Edge { int f = 0; int t = 0; int w = 0; int ori_idx = 0; bool operator<(const Edge& other) const { return w < other.w; } }; enum Color { kWhite, kGray, kBlack, }; boo...
C++
f1121338e84c757d1165d1d645bb26ed
eaae6624df1d4afc1f416341eccabeb6
2,200
PASSED
#include <iostream> #include <vector> #include <algorithm> using namespace std; struct Edge { int f = 0; int t = 0; int w = 0; int ori_idx = 0; bool operator<(const Edge& other) const { return w < other.w; } }; enum Color { kWhite, kGray, kBlack, }; bool dfs(vector<vector<...
C++
f1121338e84c757d1165d1d645bb26ed
208cc26b470e6770cae89514780ef841
2,200
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <cassert> using namespace std; struct Edge { int f = 0; int t = 0; int w = 0; int ori_idx = 0; bool operator<(const Edge& other) const { return w < other.w; } }; enum Color { kWhite, kGray, kBlack, }; boo...
C++
f1121338e84c757d1165d1d645bb26ed
a582a0fd3616ffd5032eb95933030e80
2,200
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN=1e5+10; int head[MAXN],nxt[MAXN],to[MAXN],tot,vis[MAXN],w[MAXN],st[MAXN]; int in[MAXN],n,m,cnt[MAXN],sum,need[MAXN],ans; bool f; void add_edge(int x,int y,int v) { nxt[++tot]=head[x]; head[x]=tot; st[tot]=x; to[tot]=y; w[tot]=v; } void dfs(int u,int k) {...
C++
f1121338e84c757d1165d1d645bb26ed
6f794e964dad9e055489ea83ccc8b745
2,200
PASSED
#include<algorithm> #include<iostream> #include<cstring> #include<queue> #include<cstdio> using namespace std; const int N=100010; int n,m,cnt,x,y,z,l,r,k,ans; int head[N],in[N],Ans[N],dfn[N]; struct node{ int to,nxt,dis,id; }e[N]; void add(int f,int t,int d,int id){ e[++cnt]=(node){t,head[f],d,id}; head[f]=cnt; } ...
C++
f1121338e84c757d1165d1d645bb26ed
1cc1f261ec61ee0b741b1481145e28e7
2,200
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <queue> #include <cstring> using namespace std; const int N = 1e5 + 5; int n, m, maxl = 0, indeg[N], b[N], t; int head[N], edge[N], leng[N], nxt[N], from[N]; vector<int> ans; bool v[N], w[N]; queue<int> q; void add(int x, int y, int z, int i) { edge[i...
C++
f1121338e84c757d1165d1d645bb26ed
811f8582cfaeacb00d2b82fd55b36998
2,200
PASSED
# include <iostream> # include <cstdio> # include <string> # include <queue> # include <cstring> # include <algorithm> # define ll long long using namespace std; int n,m,tot,cnt,sum,ans; int head[1000100],ru[1010000],dfn[1000100],ANS[1000100]; bool vis[1000100]; struct node{ int form;int to;int id;int val; }chen[1000...
C++
f1121338e84c757d1165d1d645bb26ed
3041aba911d2eb45038ed436f1616b28
2,200
PASSED
#include <iostream> #include <vector> using namespace std; bool isEnd(string word, string suffix) { if(suffix.length() > word.length()) { return false; } int num = suffix.length(); return word.substr(word.length() - num, num) == suffix; } bool chk(vector<string> & vec) { bool flag1 = true; bool flag2 ...
C++
0c9550a09f84de6bed529d007ccb4ae8
9362518c7251334a05844e909805f1dc
1,600
PASSED