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 <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <vector> #include <bitset> using namespace std; #define lb(x) x&-(x) #define int long long const int N=2e5+2,P=998244353; int read() { int x=0,y=1; char c=getchar(); for(;!isdigit(c);c=getchar()) if(c=='-') y=0; ...
C++
f898d3a58e0ae6ac07d0d14620d47d27
dae51f2a8de5e092e186927c3cfeb74a
1,900
PASSED
#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; #define ll long long int #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define mp make_pair #define xx first #...
C++
f898d3a58e0ae6ac07d0d14620d47d27
f954c676aa59ff8e79e000018621bf05
1,900
PASSED
#include <algorithm> #include <iostream> using namespace std; const int N = 200000; const int M = 200000; const int A = 200000; const int MD = 998244353; int aa[N], bb[M]; int kk[A], ft[A]; long long vv[N + 1], ff[N + 1], gg[N + 1]; void init() { ff[0] = gg[0] = vv[1] = ff[1] = gg[1] = 1; for (int i =...
C++
f898d3a58e0ae6ac07d0d14620d47d27
281790ff487e6fcf65df85044e0df622
1,900
PASSED
#include<bits/stdc++.h> #define int long long #define pii pair<int,int> #define pb push_back #define N 200005 #define fi first #define se second #define M 998244353 #define ls (rt<<1ll) #define rs (rt<<1ll|1ll) #define lowbit(x) ((x)&-(x)) using namespace std; int n,m,s[N],t[N],fac[N],cnt[N],ans,T[N],vis[N]...
C++
f898d3a58e0ae6ac07d0d14620d47d27
bae3c268511a1d4bccd6ab1b8d0b11a7
1,900
PASSED
#include <bits/stdc++.h> #define ll long long #define all(x) x.begin(), x.end() using namespace std; const int mod = 998244353; const int maxn = 2e5 + 3; ll fac[maxn], inv[maxn], tree[maxn * 4]; int cnt[maxn]; int n, m; ll c[maxn]; int lowbit(int x) { return x & (-x); } void update(int pos, int x){for (int i...
C++
f898d3a58e0ae6ac07d0d14620d47d27
41874c8fc4d628b58253c7e2629ad28f
1,900
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> using namespace std; typedef long long int ll; typedef long double ld; #define mod...
C++
f898d3a58e0ae6ac07d0d14620d47d27
431e860905bbcfddbb1a5cbb557a4cc4
1,900
PASSED
#include <bits/stdc++.h> using namespace std ; #define int long long #define mod 1000000007 #define modd 998244353 #define inf INT32_MAX #define INF 9e18 #define ff first #define ss second #define pb push_back #define nl '\n' #defi...
C++
ef0ad7b228351a268c3f6bfac68b1002
33e654d6de901ea68725dd6a17701151
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; const ll MAXN = 2e5 + 200; const ll MOD = 1e4 + 7; const ll INF = 1e18; const double EPS = 1e-6; #define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define file_i...
C++
ef0ad7b228351a268c3f6bfac68b1002
5dc63d3fc952aab090cd8675fa1d46a0
1,400
PASSED
/**************** *@description: *@author: Nebula_xuan * @Date: 2022-04-17 10:29:49 *for the Escape Project *************************************************************************/ #include <iostream> #include <vector> #include <algorithm> using namespace std; const int N = 1e5 + 10; vector<int> x[N...
C++
ef0ad7b228351a268c3f6bfac68b1002
0e8c580bc5855ed21ab733fc24dc4ee6
1,400
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; const int N=1e5+10; vector<int>x[N],y[N]; signed main() { ios::sync_with_stdio(false),cin.tie(0); int n,m; cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++){ int num; cin>>nu...
C++
ef0ad7b228351a268c3f6bfac68b1002
f103354f688cd2b2ddeec809725b42df
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long const int sz = 1e5 + 10; vector <int> cntx[sz], cnty[sz]; ll tail[sz]; ll cnt[sz]; ll res[sz]; ll sum[sz]; void solve() { int n, m; cin >> n >> m; for(int i = 1;i <= n;i++) { for(int j = 1;j <= m;j++) { int tt; cin >>...
C++
ef0ad7b228351a268c3f6bfac68b1002
91e30dc4acca980f3ad19096637ed483
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define _orz ios::sync_with_stdio(false),cin.tie(0) #define mem(str,num) memset(str,num,sizeof(str)) #define forr(i,a,b) for(int i = a;i <= b;i++) #define forn(i,n) for(int i = 0; i < n; i++) #define all(a) (a.begin(),a.end()) #define dbg() cout << "0k!" << endl; #define int...
C++
ef0ad7b228351a268c3f6bfac68b1002
a4e21bdaa4e4b7ebd5f0e69df89d828a
1,400
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <set> #include <vector> #include <cstring> #include <string> #include <string.h> using namespace std; typedef long long ll; const int N = 1e5+10, M = 1e6+10; typedef struct node{ int x,y; }; bool cmp1(node a, node b){ return a.x < b.x; } bool...
C++
ef0ad7b228351a268c3f6bfac68b1002
996f56f422ef6332ef9e30f9c691241f
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; int v[n][m]; map<int, vector<int>> X, Y; //曼哈顿距离XY分开处理 for (int i = 0; i < n; i++) //读图 { for (int j = 1; j <= m; j++) { ...
C++
ef0ad7b228351a268c3f6bfac68b1002
f21d77b483b7a896c8f99ed9e98ff859
1,400
PASSED
#include <bits/stdc++.h> // #include "debug.h" using namespace std; #define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield); #define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define loop(i, a, n) for(int i = a; i < n; i++) #define Loop(i,...
C++
ef0ad7b228351a268c3f6bfac68b1002
249a74ab64bc1b1ada4a51f2872dbdca
1,400
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <iterator> #include <cmath> #include <unordered_map> using namespace std; typedef long long ll; int main() { int n, m; cin >> n >> m; vector <vector<int>> a(100'001); vector <vector<...
C++
ef0ad7b228351a268c3f6bfac68b1002
fbe4bd3a7aaec3590ffdd6fd0b2970ff
1,400
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; #ifdef LOCAL ifstream in("in.in"); ofstream out("out.out"); #else #define in cin #define out cout #endif int n, q; const int nmax = 500005, inf = (1LL << 60); int a[4][nmax], s[nmax], f[nmax], dp[nmax]; struct Seg { int l, r, k; ...
C++
219d28e6ea9e49f56c420c694038850e
f22db5fe79b91fc4b20f4b5d21044c99
2,800
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; #ifdef LOCAL ifstream in("in.in"); ofstream out("out.out"); #else #define in cin #define out cout #endif int n, q; const int nmax = 500005, inf = (1LL << 60); int a[4][nmax], s[nmax], f[nmax], dp[nmax]; struct Seg { int l, r, k; ...
C++
219d28e6ea9e49f56c420c694038850e
556f00ba0e9f7d7069ed26ac4fa49f14
2,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 500010; const ll INF = 1ll * 1e9 * 1e9; int n, q; ll a[3][maxn]; int yh(){ int ret=0;bool f=0;char c=getchar(); while(!isdigit(c)){if(c==EOF)return -1;if(c=='-')f=1;c=getchar();} while(isdigit(c))ret=(ret<<3)+(ret<<1)...
C++
219d28e6ea9e49f56c420c694038850e
1858bdcaea99c125ffbc1de0c09254aa
2,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1000010; const ll INF = 1ll * 1e9 * 1e9; int n, q; int a[3][maxn]; struct Seg{ int l, r, k; bool operator < (const Seg& x) const{ if(r == x.r) return l < x.r; return r < x.r; } }s[maxn]; ...
C++
219d28e6ea9e49f56c420c694038850e
9560b3b65aa20d118736d5c8f57f2163
2,800
PASSED
#include <algorithm> #include <array> #include <cassert> #include <cmath> #include <codecvt> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <thread> #include <typeindex> #include <unordered_map> #inclu...
C++
219d28e6ea9e49f56c420c694038850e
9d81980560571bba5d63f34ee6831c02
2,800
PASSED
#include <algorithm> #include <array> #include <cassert> #include <cmath> #include <codecvt> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <thread> #include <typeindex> #include <unordered_map> #inclu...
C++
219d28e6ea9e49f56c420c694038850e
ec6ce3bc28f2784e42a0ad0f979a4bc5
2,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 5e5 + 50; const ll inf = 0x3f3f3f3f3f3f3f3f; struct node { ll l, r; ll s, f, sf; }; node tr[N << 2]; ll s[N], f[N], dp[N]; void pushup(ll u) { tr[u].s = max(tr[u << 1].s, tr[u << 1 | 1].s); tr[u].f ...
C++
219d28e6ea9e49f56c420c694038850e
78aeb0ce74566bc56a9cda9099367e72
2,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 5e5 + 50; const ll inf = 0x3f3f3f3f3f3f3f3f; struct node { ll l, r; ll s, f, sf; }; node tr[N << 2]; ll s[N], f[N], dp[N]; void pushup(ll u) { tr[u].s = max(tr[u << 1].s, tr[u << 1 | 1].s); tr[u].f ...
C++
219d28e6ea9e49f56c420c694038850e
97d98466b6417877308f0555df291f0a
2,800
PASSED
#include<bits/stdc++.h> #define int long long #define pii pair<int,int> #define pb push_back #define N 500005 #define fir first #define sec second using namespace std; vector<pii >g[N]; int n,m,a[4][N],sum[4][N],ans=-1e18; struct node{ int fi,si,val; friend node operator + (const node& x,const node& y){ ...
C++
219d28e6ea9e49f56c420c694038850e
e2fe3b26456f17fe6ea93a476490ddb6
2,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define F first #define S second #define pb push_back #define endl "\n" #define all(x) x.begin(), x.end() const int M = 500007; const ll inf = 1e18; const ll mod = 1e9+7; const double pi = acos(-1); const in...
C++
219d28e6ea9e49f56c420c694038850e
2fc4c3e9a9146614f049f421d2254e25
2,800
PASSED
/* ___ (o,o) < . > --"-"--- Rowlet is orz _ _ _ >(.)__ <(.)__ =(.)__ (___/ (___/ (___/ I am dum duck */ #include <bits/stdc++.h> using namespace std; #define FF first #define SS second #define pb push_back #define ll long long #define ld long double #define INF 1000000000ll #define MOD 1000000007ll...
C++
5de2777a63c0c889da36c32df91744cf
5e4285c552b6bc0c7b90e85521cb3928
2,300
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; int main() { int n, k; cin >> n >> k; int ans = 0; if (n % 2 == 1 && k % 2 == 0) { cout << "-1" << endl; return 0; } int boun...
C++
5de2777a63c0c889da36c32df91744cf
f1ec517b569c9a05f6499866fb18858c
2,300
PASSED
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define eb emplace_back #define popcnt __builtin_popcount #define popcntll __builtin_popcountll #define all(a) begin(a), end(a) using namespace std; int n, k; int query(vector<int> const &v) { cout << "? "; for (auto a : v) cout <...
C++
5de2777a63c0c889da36c32df91744cf
18188bfd05ac60a217e86c56ecb1d96c
2,300
PASSED
#include <bits/stdc++.h> using namespace std; template<typename T> int SIZE(T (&t)){ return t.size(); } template<typename T, size_t N> int SIZE(T (&t)[N]){ return N; } string to_string(char t){ return "'" + string({t}) + "'"; } string to_string(bool t){ return t ? "true" : "false"; ...
C++
5de2777a63c0c889da36c32df91744cf
6c7e60af92b2174c1daf5d7646c0647f
2,300
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { #ifdef LOCAL // freopen("input.txt", "r", stdin); // freopen("log.txt", "w", stdout); #endif int n, k; cin >> n >> k; vector<int> d(n + 1, (int)1e9), par(n + 1); d[0] ...
C++
5de2777a63c0c889da36c32df91744cf
71d40480e0808fd78f57c797ccd289e5
2,300
PASSED
#include<bits/stdc++.h> #define int long long #define pb push_back #define mp make_pair #define x first #define y second #define WT int TT=read();while(TT--) #define NO puts("NO"); #define YES puts("YES"); using namespace std; inline int read() { char c=getchar();int x=0;bool f=0; for(;!isdigit(...
C++
5de2777a63c0c889da36c32df91744cf
541be8313824a5b4e44f7372834d3089
2,300
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int mx=509; const ll inf =1e9; const int mod=1e9+7; int n,k; int dist[mx],par[mx],vis[mx],in[mx];int even[mx]; int ask(vector<int> v){ cout << "?"; for(auto x : v)cout << " " << x; cout << endl; int ans; cin >> ans; ...
C++
5de2777a63c0c889da36c32df91744cf
46aedc13cdc48db250954ad9e0a33775
2,300
PASSED
#include <cstdio> using namespace std; const int N=503; int que[N<<7],tmp[N<<7],tl; bool vis[N],cur[N]; int n,k; int pre[N]; int read(){ char c=getchar();int x=0; while(c<48||c>57) c=getchar(); do x=(x<<1)+(x<<3)+(c^48),c=getchar(); while(c>=48&&c<=57); return x; } int main(){ n=read();k=read(); if(n&~k&1){puts(...
C++
5de2777a63c0c889da36c32df91744cf
18dd573b0fb6f82d0df28fb2be42bed4
2,300
PASSED
#include<bits/stdc++.h> #define N 505 #define int long long #define pii pair<int,int> #define mk make_pair using namespace std; inline int rd(){ int X=0,w=0; char ch=getchar(); while(!isdigit(ch)) {w|=ch=='-';ch=getchar();} while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar(); return w?-X:X...
C++
5de2777a63c0c889da36c32df91744cf
bbf5f0433a2c173d3ed0b639e251ff29
2,300
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; int n,k,sum,la; int a[505],ans; priority_queue<pair<int,int>> q; vector<pair<int,int> > t; signed main() { ios::sync_with_stdio(0); cin>>n>>k; if(!(k%2)&&n%2) return cout<<-1,0; sum=n; for(int i=1;i<=n;i++) a[i]=1; while(1) { i...
C++
5de2777a63c0c889da36c32df91744cf
6ad1ac0d5097f7f957fa7ac8a68e4d18
2,300
PASSED
#include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> input(){ vector<pair<int,int>>arr(n); for(int i=0;i<n;i++){ cin>>arr[i].first; arr[i].second=i+1; } return arr; } int main(){ int odd=0,even=0; cin>>n; vector<pair<int,int>>pr; set<pair<int,int>>ans...
C++
5dbafdd7c4e93b2c01122fa80ef42f0e
33cf05a33c6a831a7217af59e3989014
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> input(){ vector<pair<int,int>>arr(n); for(int i=0;i<n;i++){ cin>>arr[i].first; arr[i].second=i+1; } return arr; } int main(){ int odd=0,even=0; cin>>n; vector<pair<int,int>>pr; set<pair<int,int>>ans...
C++
5dbafdd7c4e93b2c01122fa80ef42f0e
23a1e6e252ba1c0e2a18c2ff0aa0ea56
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> input(){ vector<pair<int,int>>arr(n); for(int i=0;i<n;i++){ cin>>arr[i].first; arr[i].second=i+1; } return arr; } int main(){ int odd=0,even=0; cin>>n; vector<pair<int,int>>pr; set<pair<int,int>...
C++
5dbafdd7c4e93b2c01122fa80ef42f0e
3e63f448a7a0ae6cd9c4268093f32c99
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> input(){ vector<pair<int,int>>arr(n); for(int i=0;i<n;i++){ cin>>arr[i].first; arr[i].second=i+1; } return arr; } int main(){ int odd=0,even=0; cin>>n; vector<pair<int,int>>pr; set<pair<int,int>...
C++
5dbafdd7c4e93b2c01122fa80ef42f0e
11f9e73fc217ea4b9179d71eef317d7b
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> input(){ vector<pair<int,int>>arr(n); for(int i=0;i<n;i++){ cin>>arr[i].first; arr[i].second=i+1; } return arr; } int main(){ int odd=0,even=0; cin>>n; vector<pair<int,int>>pr; set<pair<int,int>...
C++
5dbafdd7c4e93b2c01122fa80ef42f0e
450b94cb9ca7e7b8f9d09c29450690f8
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> input(){ vector<pair<int,int>>arr(n); for(int i=0;i<n;i++){ cin>>arr[i].first; arr[i].second=i+1; } return arr; } int main(){ int odd=0,even=0; cin>>n; vector<pair<int,int>>pr; set<pair<int,int>...
C++
5dbafdd7c4e93b2c01122fa80ef42f0e
7766f4f73441f4054b50f4614dd716e7
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> input(){ vector<pair<int,int>>arr(n); for(int i=0;i<n;i++){ cin>>arr[i].first; arr[i].second=i+1; } return arr; } int main(){ int odd=0,even=0; cin>>n; vector<pair<int,int>>pr; set<pair<int,int>>ans...
C++
5dbafdd7c4e93b2c01122fa80ef42f0e
5c206562ad8ede2d34ee759df247a8ae
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> input(){ vector<pair<int,int>>arr(n); for(int i=0;i<n;i++){ cin>>arr[i].first; arr[i].second=i+1; } return arr; } int main(){ int odd=0,even=0; cin>>n; vector<pair<int,int>>pr; set<pair<int,int>>ans...
C++
5dbafdd7c4e93b2c01122fa80ef42f0e
177d4503369050ca5f33aade4e8ca86b
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> input(){ vector<pair<int,int>>arr(n+1); for(int i=1;i<=n;i++){ cin>>arr[i].first; arr[i].second=i; } return arr; } int main(){ int odd=0,even=0; cin>>n; vector<pair<int,int>>pr; set<pair<int,int>>an...
C++
5dbafdd7c4e93b2c01122fa80ef42f0e
ff05d704facb1af7d86e35b88836cd9a
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> input(){ vector<pair<int,int>>arr(n+1); for(int i=1;i<=n;i++){ cin>>arr[i].first; arr[i].second=i; } return arr; } int main(){ int odd=0,even=0; cin>>n; vector<pair<int,int>>pr; set<pair<int,int>>an...
C++
5dbafdd7c4e93b2c01122fa80ef42f0e
6c069102b4cc4147affaa70e1a093b88
1,800
PASSED
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int64_t epsilon = 1e18; int lim = 1e5; vector<vector<int>> g((lim << 2) + 1); vector<bool> vis((lim << 2) + 1, false); void dfs(int v){ vis[v] = true; for(auto i : g[v]){ if(!vis[i]){ dfs(i); ...
C++
3f1e2549d7342364b08f976fcbb7b1fa
c385fb20913df626de97ef3e58903025
1,300
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_stati...
C++
3f1e2549d7342364b08f976fcbb7b1fa
6e720a377ed570a96b260af951d83313
1,300
PASSED
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<cstdio> #include<string> #include<cctype> #include<algorithm> #include<numeric> #include<cmath> #include<iomanip> #include<vector> #include<iomanip> using ll = long long; const ll big = 1e9 + 7; using dbl = double; using namespace std; ll search...
C++
3f1e2549d7342364b08f976fcbb7b1fa
171130366c06098356bcf6854921a9e1
1,300
PASSED
#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; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; #define nline "\n" #define M (int)1e9 + 7 #define int long long #...
C++
3f1e2549d7342364b08f976fcbb7b1fa
5b8b5decc44d3e738d6f35563966fb4c
1,300
PASSED
#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; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; #define nline "\n" #define M (int)1e9 + 7 #define int long long #...
C++
3f1e2549d7342364b08f976fcbb7b1fa
8f6405ca9407a471ece3e7d348d25160
1,300
PASSED
#include "bits/stdc++.h" using namespace std; using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; template<typename T> int sz(const T &a){return int(a.size());} const int MN=4e5+1; const ll mod=1e9+7; bool gone[MN]; vector<int> adj[MN]; int arr[MN][2]; void dfs(int loc){ gone[loc]...
C++
3f1e2549d7342364b08f976fcbb7b1fa
3541c5c15986fc5c21583361e30cb56d
1,300
PASSED
#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; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; #define nline "\n" #define M (int)1e9 + 7 #define int long long #...
C++
3f1e2549d7342364b08f976fcbb7b1fa
7a9385c37c6e1b2ad3bd71dd781547d5
1,300
PASSED
#include <iostream> #include <vector> using namespace std; const long long mod = 1e9 + 7; void dfs(int next, vector<vector<int>> & vec, vector<int>& vis) { if (vis[next] == 1) return; vis[next] = 1; for (auto& v : vec[next]) { dfs(v, vec, vis); } } int main() { cin.tie(NULL); ios_base::sync...
C++
3f1e2549d7342364b08f976fcbb7b1fa
8a6fb9ee09457d977dfc580ca6eaaffc
1,300
PASSED
#include<iostream> #include<iomanip> #include<algorithm> #include<vector> #include<utility> #include<set> #include<unordered_set> #include<list> #include<iterator> #include<deque> #include<queue> #include<stack> #include<set> #include<bitset> #include<random> #include<map> #include<unordered_map> #incl...
C++
3f1e2549d7342364b08f976fcbb7b1fa
2a318d9914f3159b67ed286a1963f573
1,300
PASSED
#include <bits/stdc++.h> using namespace std; const int MAX_N = 4 * 1e5 + 1; const long long MOD = 1e9 + 7; int nums[2][MAX_N]; int pos[2][MAX_N]; bool visited[MAX_N]; void dfs(int s) { if (visited[s]) return; visited[s] = true; int n1 = nums[0][s], n2 = nums[1][s]; dfs(pos[0][n2]); ...
C++
3f1e2549d7342364b08f976fcbb7b1fa
2b9479f357cfe0201a25b3d55ad7e2e4
1,300
PASSED
#include<bits/stdc++.h> #define f first #define s second #define pb push_back #define read(x) for(auto& qw : (x)) cin >> qw; #define endl "\n"; //para problemas iterativos comentar essa linha #define all(v) v.rbegin(), v.rend() using namespace std; typedef long long ll; typedef pair<ll,ll> pii; const int...
C++
6313b2788fbf58b9b7c70fc85afa4c1c
50d5b3844df692006daa3dd4bf1e9160
1,100
PASSED
#include<bits/stdc++.h> #define f first #define s second #define pb push_back #define read(x) for(auto& qw : (x)) cin >> qw; #define endl "\n"; //para problemas iterativos comentar essa linha #define all(v) v.rbegin(), v.rend() using namespace std; typedef long long ll; typedef pair<ll,ll> pii; const int...
C++
6313b2788fbf58b9b7c70fc85afa4c1c
6f2f332c548fb20762de642336519e71
1,100
PASSED
#include <bits/stdc++.h> #include <bits/extc++.h> using namespace std; #define pushb push_back #define pushf push_front #define popb pop_back #define popf pop_front #define empl emplace #define emplb emplace_back #define emplf emplace_front #define fi first #define se second #define mkp make_pair #define mkt make_tupl...
C++
6313b2788fbf58b9b7c70fc85afa4c1c
febaf077e8896d4a12c2e5a877b95ab1
1,100
PASSED
#include <bits/stdc++.h> #include <bits/extc++.h> using namespace std; #define pushb push_back #define pushf push_front #define popb pop_back #define popf pop_front #define empl emplace #define emplb emplace_back #define emplf emplace_front #define fi first #define se second #define mkp make_pair #define mkt make_tupl...
C++
6313b2788fbf58b9b7c70fc85afa4c1c
5c3c048abba2eeb1642b156ea98cbd8a
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define inf (1<<30) signed main(){ int t;cin>>t; while(t--){ int n;cin>>n; vector<int> a(n); for(auto&i:a)cin>>i; a.emplace_back(0); int ans=0; for(int i=0;i<n;i++) if((i?a[i-1]:0)<a[i] and a[i]>a[i+1]){ ans+=a[i]-m...
C++
6313b2788fbf58b9b7c70fc85afa4c1c
38f6d684b280a2a80e67a8cbedb7b954
1,100
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int a[1000010]; signed main() { int t; cin >> t; while(t -- ) { int n; cin >> n; int x; int maxx = 0; int res = 0; a[0] = a[n + 1] = 0; for(int i = 1 ; i <= n; i ++ ) { scanf("%lld", &x); a[i] = x; } for(i...
C++
6313b2788fbf58b9b7c70fc85afa4c1c
d06b6f26993678d3f15da1e384ed3b1f
1,100
PASSED
#include <bits/stdc++.h> using namespace std; //looping #define fr(i,a) for(int i=0;i<a;i++) #define f1r(i,a) for(int i=1;i<a;i++) #define fe(i,a) for(int i=0;i<=a;i++) #define f1e(i,a) for(int i=1;i<=a;i++) #define fu(i,a,n) for(int i=a;i<n;i++) #define fue(i,a,n) for(int i=a;i<=n;i++) #define fd(...
C++
6313b2788fbf58b9b7c70fc85afa4c1c
57111daa3cf281be90a9294c24053f53
1,100
PASSED
#include <bits/stdc++.h> using namespace std; //looping #define fr(i,a) for(int i=0;i<a;i++) #define f1r(i,a) for(int i=1;i<a;i++) #define fe(i,a) for(int i=0;i<=a;i++) #define f1e(i,a) for(int i=1;i<=a;i++) #define fu(i,a,n) for(int i=a;i<n;i++) #define fue(i,a,n) for(int i=a;i<=n;i++) #define fd(...
C++
6313b2788fbf58b9b7c70fc85afa4c1c
80229eb6ab1d5df14028882067a63606
1,100
PASSED
#include <bits/stdc++.h> using namespace std; //looping #define fr(i,a) for(int i=0;i<a;i++) #define f1r(i,a) for(int i=1;i<a;i++) #define fe(i,a) for(int i=0;i<=a;i++) #define f1e(i,a) for(int i=1;i<=a;i++) #define fu(i,a,n) for(int i=a;i<n;i++) #define fue(i,a,n) for(int i=a;i<=n;i++) #define fd(...
C++
6313b2788fbf58b9b7c70fc85afa4c1c
f64228e7286509026c1c749d386470cf
1,100
PASSED
// Problem: B. Histogram Ugliness // Contest: Codeforces - Codeforces LATOKEN Round 1 (Div. 1 + Div. 2) // URL: https://codeforces.com/problemset/problem/1534/B // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include<bits/stdc++.h> #define ll long long #defi...
C++
6313b2788fbf58b9b7c70fc85afa4c1c
b356ac7065fc6891e2c78236c3a7cd2c
1,100
PASSED
#include<iostream> #include<cstring> #include<queue> using namespace std; char a[55][55]; int vis[55][55]; int n,m; int sx,sy; int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; bool check(int x,int y) { return x>=1&&x<=n&&y>=1&&y<=m&&!vis[x][y]; } bool bfs() { queue<pair<int,int>> q; vis[sx][sy]=1; q.push({sx,s...
C++
12f35743f482b68e3156a45d6ac5bb14
a9a799eb341f5f30d7d2c633a60f993f
800
PASSED
#include<iostream> #include<queue> #include<cstring> using namespace std; char a[55][55]; int vis[55][55]; int n,m; int sx,sy; char s; char e; void solve() { sx=0; //memset(a,'.',sizeof(a)); bool flag=true; cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { cin>>a[i][j]; ...
C++
12f35743f482b68e3156a45d6ac5bb14
3738ab210e869976413b2ad8f5c0faef
800
PASSED
#include<iostream> #include<queue> #include<cstring> using namespace std; char a[55][55]; int vis[55][55]; int n,m; int sx,sy; char s; char e; void solve() { sx=0; //memset(a,'.',sizeof(a)); bool flag=true; cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { cin>>a[i][j]; ...
C++
12f35743f482b68e3156a45d6ac5bb14
6355eb618d43da94c80ffaac7996c031
800
PASSED
// 大健健保佑, 不卡bug,OoO #include <iostream> #include <algorithm> #include <string> #include <queue> #include <cstring> using namespace std; const int maxn = 2e3; int n, m; char G[maxn][maxn]; int vis[maxn][maxn]; char getch() { char ch = getchar(); while (isspace(ch)) ch = getchar(); return ch; } int dx...
C++
12f35743f482b68e3156a45d6ac5bb14
ca7fce8556ce663f686bb34a4de6c469
800
PASSED
#include<iostream> using namespace std; char grid[51][51], ans[51][51]; int n, m; bool isvalid(int i, int j, char color) { if (i == n) return true; if (j == m) { if (ans[i][0] == 'R') color = 'W'; else color = 'R'; return isvalid(i + 1, 0, color); } if (grid[i][j] != '.' && grid[i][j] != ...
C++
12f35743f482b68e3156a45d6ac5bb14
28faedfe4384b631fc511d7ca5d905fd
800
PASSED
#include<iostream> #include<vector> using namespace std; int n, m; char grid[60][60],ans[60][60]; bool isvalid(int i, int j, char colour) { if (i == n) return true; if (j == m) { if (ans[i][0] == 'W') colour = 'R'; else colour = 'W'; return isvalid(i + 1, 0, colour); } if (grid[i][j] != ...
C++
12f35743f482b68e3156a45d6ac5bb14
a650465d60f4c42ef708f854fce677f6
800
PASSED
#include<iostream> #include<vector> using namespace std; bool isvalid(char** arr, int n, int m,char colour) { char c = colour; for (int i = 0; i < n; i++) { if (i > 0) { if (arr[i - 1][0] == 'R') c = 'W'; else c = 'R'; } int k = 0; for (int j = 0; j < m; j++) { if (arr[i][...
C++
12f35743f482b68e3156a45d6ac5bb14
ed2ea2ac619c2265b5271170182a23c6
800
PASSED
#include<iostream> #include<cstring> #include<queue> using namespace std; char a[55][55]; int vis[55][55]; int n,m; int sx,sy; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; bool check(int x,int y) { return x>=1&&x<=n&&y>=1&&y<=m&&!vis[x][y]; } bool bfs() { queue<pair<int,int>> q; vis[sx][sy]=1; q.push({sx...
C++
12f35743f482b68e3156a45d6ac5bb14
a3ed853a7063c10acd93bb20806d2b3d
800
PASSED
#include<iostream> #include<cstring> #include<queue> using namespace std; char a[55][55]; int vis[55][55]; int n,m; int sx,sy; int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; char s,e; bool check(int x,int y) { return x>=1&&x<=n&&y>=1&&y<=m&&!vis[x][y]; } bool bfs() { queue<pair<int,int>> q; vis[sx][sy]=1; q....
C++
12f35743f482b68e3156a45d6ac5bb14
daed109bb95f01108c0d0d0c0a24c372
800
PASSED
#include<iostream> #include<queue> #include<cstring> using namespace std; char a[55][55]; int vis[55][55]; int n,m; int sx,sy; char s; char e; void solve() { sx=0; //memset(a,'.',sizeof(a)); bool flag=true; cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { cin>>a[i][j]; ...
C++
12f35743f482b68e3156a45d6ac5bb14
0d01533c84ce77d1ce7a80e8eade6828
800
PASSED
#include<bits/stdc++.h> using namespace std; const int MAXN=400000; const int INF=2e9; vector<int> g[MAXN+10]; void adde(int u,int v){ g[u].push_back(v); } int n,m; int a[MAXN+10]; vector<int> sand[MAXN+10]; char ch[MAXN+10]; int id(int i,int j){ return (i-1)*n+j; } bool tag[MAXN+10]; int idx; int df...
C++
1254d7ee968ed89a229e02ccefaf5994
a2eb6beb181a80a43c6c58c026c0d2f2
3,000
PASSED
#pragma GCC optimize("Ofast","inline","-ffast-math") #pragma GCC target("avx,sse2,sse3,sse4,mmx") #include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/hash_policy.hpp> //#define int long long using namespace __gnu_pbds; using namespace std; struct custom_hash { static uint6...
C++
1254d7ee968ed89a229e02ccefaf5994
4ae9e9dc227034154ffc1bde8ddf82dd
3,000
PASSED
#include<bits/stdc++.h> using namespace std; int n,m; int a[400040],col[400040],mn[400040],tot; inline int g(int x,int y){ return (x-1)*m+y; } struct edge{ int nxt,to; }e[1600010]; int head[400040],in[400040],cnt; inline void add(int u,int v){ e[++cnt].nxt=head[u]; e[cnt].to=v; head[u]=cnt; } struc...
C++
1254d7ee968ed89a229e02ccefaf5994
005cdffdf12b704c7154af086f371031
3,000
PASSED
#include<algorithm> #include<cstring> #include<cctype> #include<cstdio> #define rep(i,x,y) for(int i=x; i<=y; ++i) #define repd(i,x,y) for(int i=x; i>=y; --i) #define id(x,y) (((x)-1)*m+(y)) using namespace std; const int N=400005; bool mp[N]; char s[N]; int n,m,a[2][N],f[N],ans; int getint() { char ...
C++
1254d7ee968ed89a229e02ccefaf5994
a8aff52156e0c9d99b6890f847a7b186
3,000
PASSED
#include <bits/stdc++.h> using namespace std; // macros typedef long long ll; typedef long double ld; typedef pair<int, int> ii; typedef pair<ll, ll> lll; typedef tuple<int, int, int> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<iii> viii; typedef vector<ll> vll; typedef vector<lll...
C++
1254d7ee968ed89a229e02ccefaf5994
feb17603318553c8831befdff485b20a
3,000
PASSED
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> pi; const int maxn=4e5+5; struct edge { int next,to; } e[maxn*20]; struct node { int l,r; node() {} node(int l,int r) { this->l=l,this->r=r; } friend bool operator<(node a,node b) { return a.l>b.l; } } p[maxn]; char tmp[maxn*...
C++
1254d7ee968ed89a229e02ccefaf5994
a485635af507634d93ad21950a4f9b5d
3,000
PASSED
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> pi; const int maxn=4e5+5; struct edge { int next,to; } e[maxn*20]; struct node { int l,r; node() {} node(int l,int r) { this->l=l,this->r=r; } friend bool operator<(node a,node b) { return a.l>b.l; } } p[maxn]; char tmp[maxn*...
C++
1254d7ee968ed89a229e02ccefaf5994
fbcb8a68827908f686b0528ecd4a80c9
3,000
PASSED
#include<bits/stdc++.h> using namespace std; const int max_m=4e5+5; char str[max_m]; const int max_tot=4e5+5; int End[max_tot<<2],Last[max_tot],Next[max_tot<<2],e; inline void add_edge(int x,int y) { End[++e]=y; Next[e]=Last[x]; Last[x]=e; } int dfn[max_tot],low[max_tot],Time,st[max_tot],tp; bool mark_i...
C++
1254d7ee968ed89a229e02ccefaf5994
21b8de900b262c22c8c175fbe1e686d2
3,000
PASSED
#include<bits/stdc++.h> using namespace std; const int max_m=4e5+5; char str[max_m]; const int max_tot=4e5+5; int End[max_tot<<2],Last[max_tot],Next[max_tot<<2],e; inline void add_edge(int x,int y) { // fprintf(stderr,"add_edge: x=%d y=%d\n",x,y); End[++e]=y; Next[e]=Last[x]; Last[x]=e; } int dfn[max_to...
C++
1254d7ee968ed89a229e02ccefaf5994
d2db741d3d01a04173b9ce0adf60d6c4
3,000
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 400010; int n, m, a[N], S[N], L[N], R[N], nxt[N]; char t[N]; int &s(int i, int j) { return S[(i - 1) * m + j]; } int &l(int i, int j) { return L[(i - 1) * m + j]; } int &r(int i, int j) { return R[(i - 1) * m + j]; } void dfs(int x, int y, int ...
C++
1254d7ee968ed89a229e02ccefaf5994
27cc7757880d2a891f055cc4d052595d
3,000
PASSED
//2021.9.6 by ljz //email 573902690@qq.com //if you find any bug in my code //please tell me //#pragma GCC optimize(2) //#pragma GCC optimize(3) //#pragma GCC optimize("Ofast") #include<bits/stdc++.h> //#include<ext/pb_ds/tree_policy.hpp> //#include<ext/pb_ds/assoc_container.hpp> using namespace std; //using...
C++
bec262476695715f181c774355cfeada
dd527b599568ccfd284cd1678799542c
3,500
PASSED
// LUOGU_RID: 94305358 #include <bits/stdc++.h> using namespace std; #define TIME 1e3 * clock() / CLOCKS_PER_SEC inline int read() { int x = 0; char s = getchar(); while(!isdigit(s)) s = getchar(); while(isdigit(s)) x = x * 10 + s - '0', s = getchar(); return x; } constexpr int N = 1e5 + 5; vector<int> e[N];...
C++
bec262476695715f181c774355cfeada
888b3c57c6c8bf9a1e6236b97e845f21
3,500
PASSED
#include <bits/stdc++.h> using namespace std; #define TIME 1e3 * clock() / CLOCKS_PER_SEC inline int read() { int x = 0; char s = getchar(); while(!isdigit(s)) s = getchar(); while(isdigit(s)) x = x * 10 + s - '0', s = getchar(); return x; } constexpr int N = 1e5 + 5; vector<int> e[N]; int n, r,...
C++
bec262476695715f181c774355cfeada
ed18ad9d4d8f1e1cf76bc8d3484da48c
3,500
PASSED
#include<bits/stdc++.h> using namespace std; #define N 100010 #define pb push_back #define mp make_pair struct edge{ int ne,to; }a[N*2]; int n,f[N],num,head[N],qwq[N],faa[N]; vector<int> s[N],suf[N],pre[N],ans; void add(int u,int v){ a[++num].ne=head[u]; a[num].to=v; head[u]=num; return ; } bool cmp...
C++
bec262476695715f181c774355cfeada
a500e8753e963ccc323453d5ab03489b
3,500
PASSED
#include <bits/stdc++.h> using namespace std; inline int read(){ int f=1,r=0;char c=getchar(); while(!isdigit(c))f^=c=='-',c=getchar(); while(isdigit(c))r=(r<<1)+(r<<3)+(c&15),c=getchar(); return f?r:-r; } #define fi first #define se second const int N=1e5+7; int n,f[N],go[N],g[N],pre[N],suf[N],pa[N]; vector<int>G[...
C++
bec262476695715f181c774355cfeada
52f8adeddd07b00c1ed35bb423d779a4
3,500
PASSED
// Awwawa! Dis cold yis ratten buy tEMMIE! #include <bits/stdc++.h> #define ll long long #define maxn 500005 /*rem*/ #define mod 1000000007 #define db double #define vi vector<int> #define pb push_back #define mp make_pair #define pi pair<int, int> #define fi first #define se second template <typename T> bool chkmax(T...
C++
bec262476695715f181c774355cfeada
67fba367694cb03e1dbcb4de007258ea
3,500
PASSED
#include<bits/stdc++.h> #define For(i,L,R) for(register int i=(L);i<=(R);++i) #define For_down(i,R,L) for(register int i=(R);i>=(L);--i) using namespace std; constexpr int n_MAX=100000+5; int Fa[n_MAX],leftmost_Leaf[n_MAX]; vector<int> son[n_MAX]; int F[n_MAX]; struct Compare{inline bool operator () (const int u,...
C++
bec262476695715f181c774355cfeada
9e3f258ff6334edd3741c834be0e6963
3,500
PASSED
#include<bits/stdc++.h> using namespace std; #define F fflush(stdout) inline int in(){ int x; scanf("%d",&x); return x; } const int N=1e5+5; vector<int> e[N]; int n,ans,f[N]; inline bool cmp(int a,int b){return f[a]>f[b];} int dep[N]; void dfs1(int x,int fa){ f[x]=0; dep[x]=dep[fa]+1; for(int y:...
C++
bec262476695715f181c774355cfeada
cce025ba11d451b347684dbc37e41265
3,500
PASSED
#include <bits/stdc++.h> #define rep(x, a, b) for (int x = (a); x <= (b); x ++ ) #define per(x, a, b) for (int x = (a); x >= (b); x -- ) #define pb push_back #define fi first #define se second #define pii pair < int, int > #define mp make_pair #define _ 100005 using namespace std; vector < int > res, g[_], ng[_]; in...
C++
bec262476695715f181c774355cfeada
7c6eec54b75047c13550ac236a09e3ce
3,500
PASSED
#include<bits/stdc++.h> #define ll long long #define db double #define mp make_pair #define fi first #define se second #define pii pair<int,int> using namespace std; int read(){ int sum=0,f=1; char st=getchar(); while(st<'0'||st>'9'){ if(st=='-')f=-1; st=getchar(); } while('0'<=st&&st<='9'){ sum=(sum<<3)+(...
C++
bec262476695715f181c774355cfeada
6c3d75fc21f3e68d5ca782f7f50b4d68
3,500
PASSED
#include<bits/stdc++.h> using namespace std; inline void read(int &x){ x=0; int y=1; char a; a=getchar(); while(a<'0'||a>'9'){ if(a=='-')y=-1; a=getchar(); } while(a>='0'&&a<='9'){ x=x*10+a-'0'; a=getchar(); } x*=y; } int n,m; string f[400008],fz[400008]; int ft; int qfz[400008]; v...
C++
7030441bd7f8f34b007f959698f4739d
00f9d959927bc06660417820ba81e3ba
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define sz(a) (int)(a).size() #define rep(i, a, b) for (int i = (a), _b = (b); i < _b; ++i) #define debug(a) cerr << #a << ": " << (a) << '\n'; #define debug_arr(a, n) { cerr << #a << " "; rep(i, 0, n) cerr << a[i] << " \n"[(i + 1) == n]; } #define debug_two(a, b) c...
C++
7030441bd7f8f34b007f959698f4739d
1c1e3528d3bf01233cefaa8494285ef2
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define sz(a) (int)(a).size() #define rep(i, a, b) for (int i = (a), _b = (b); i < _b; ++i) #define debug(a) cerr << #a << ": " << (a) << '\n'; #define debug_arr(a, n) { cerr << #a << " "; rep(i, 0, n) cerr << a[i] << " \n"[(i + 1) == n]; } #define debug_two(a, b) c...
C++
7030441bd7f8f34b007f959698f4739d
d6a80dfd50d9bc20699f5c1ac08aa60f
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int maxN = 4e5+100; int n, m, ans, cnt_lt, cnt, N1, N2; int a[maxN], num[maxN], low[maxN], id[maxN], deg[maxN]; string c[maxN]; vector<int> d[maxN]; const int di[4]={-1, 0, 1, 0}, dj[4]={0, -1, 0, 1}; vector<int> e[maxN], e2[maxN]; set<int> Q; vector<int> ...
C++
7030441bd7f8f34b007f959698f4739d
8414e4543c146787faf010321f149466
2,500
PASSED