source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include <bits/stdc++.h> using namespace std; #define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define MOD 1000000007 int main() { FAST; //mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); int T; cin >> T; int N, A; int i, j, k; for(i = 0; i < T; i++...
C++
81f4bc9ac72ed39da8614131954d0d99
68a1111127aded1994ecddb8dd5408be
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define MOD 1000000007 int main() { FAST; //mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); int T; cin >> T; for(int i = 0; i < T; i++) { int N; cin >> ...
C++
81f4bc9ac72ed39da8614131954d0d99
351c28ce4e1a7560af9d02862541483c
1,300
PASSED
#include <bits/stdc++.h> #define forn(i,n) for(int i=0;i<(int)n;i++) #define forx(i,x,n) for(int i=x;i<(int)n;i++) #define ce(e,i,n) cout<<e<<" \n"[i==(int)n-1]; using namespace std; typedef long long ll; typedef pair<int,int> ii; typedef pair<ll,ll> pll; const int N=2e5+2; int a[N]; int main(){ ios_base::s...
C++
81f4bc9ac72ed39da8614131954d0d99
b1a6629d3726fd596b1772976d4b1539
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define MOD 1000000007 int main() { FAST; //mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); int T; cin >> T; int i, j, k; for(i = 0; i < T; i++) { int N;...
C++
81f4bc9ac72ed39da8614131954d0d99
ca346853f88bdbd9d98281c6cb32e9d0
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define MOD 1000000007 int main() { FAST; //mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); int T; cin >> T; int i, j, k; for(i = 0; i < T; i++) { int N;...
C++
81f4bc9ac72ed39da8614131954d0d99
ba73f57ebc77b2681f8512cc856598bf
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define MOD 1000000007 int main() { FAST; //mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); int T; cin >> T; int i, j, k; for(i = 0; i < T; i++) { int N;...
C++
81f4bc9ac72ed39da8614131954d0d99
1db284a607ed66ccce2162003dda7212
1,300
PASSED
//#define _CRT_SECURE_NO_WARNINGS #pragma GCC optimize("O3,unroll-loops,no-stack-protector,inline") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,tune=native") /* #pragma GCC optimize("section-anchors") #pragma GCC optimize("profile-values,profile-reorder-functions,tracer") #p...
C++
e1079fe293b5eef766df186bf0d72561
7ad515864898cfbb78a9aefc5098206f
2,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1000005; int n; struct node { int a, s; bool operator < (const node b) const { if (max(a, s) != max(b.a, b.s)) return max(a, s) < max(b.a, b.s); return s < b.s; } } T[maxn]; int main() { int p; scanf("%d%d", &...
C++
e1079fe293b5eef766df186bf0d72561
dec71afeb6cd6d41a715dfc8baf4a9b4
2,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1000005; int n; struct node { int a, s; bool operator < (const node b) const { if (max(a, s) != max(b.a, b.s)) return max(a, s) < max(b.a, b.s); if (s != b.s) return s < b.s; return a < b.a; } } T[maxn]; int ma...
C++
e1079fe293b5eef766df186bf0d72561
81d9fd62cd15cc7d53cd749ba2bee3d8
2,700
PASSED
//I wrote this code 4 u today #include <bits/stdc++.h> #define vc vector #define nd node* #define pnd pair<nd, nd> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef pair<ll, ll> pll; typedef vc<pll> vpll; typedef vc<vll> vvll; typedef vc<vpll> vvpll; template<const ll MOD> ...
C++
e1079fe293b5eef766df186bf0d72561
5396c07d17400e5757cbcf4dcf71a704
2,700
PASSED
#include <bits/stdc++.h> using namespace std; /// Code by Moolamp #define pb push_back #define dbg(x) cerr << (#x) << ": " << (x) << '\n' #define up(x) ceil((long double)(x)) #define fi first #define se second ...
C++
e1079fe293b5eef766df186bf0d72561
bd9373cba577d38d48cb44b0f7e6dc38
2,700
PASSED
//#define _GLIBCXX_DEBUG //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; //#include <ext/pb_ds/assoc_container.hpp> // //using namespace __gnu_pbds; // //template<type...
C++
e1079fe293b5eef766df186bf0d72561
d9152e9dcea0ea5536bf17400721c63a
2,700
PASSED
#include <iostream> #include <cstdlib> #include <cstdio> #include <algorithm> #include <set> using namespace std; inline int read() { int f = 1, x = 0; char ch; do{ ch = getchar(); if (ch == '-') f = -1; }while(ch < '0' || ch > '9'); do{ x = x * 10 + ch - '0'; ch = getchar(); }while...
C++
e1079fe293b5eef766df186bf0d72561
145e335c67ee0d7804f0fbfee2bf895b
2,700
PASSED
#import<bits/stdc++.h> using namespace std; int n,d,r,i,x,y; array<int,3>a[1<<19]; main(){ cin>>n>>d; for(;i<n;i++)cin>>x>>y,a[i]={max(x,y),x,y};sort(a,a+n); for(i=0;i<n;i++)if(d<=a[i][1])d=max(d,a[i][2]),r++; cout<<r<<'\n'; }
C++
e1079fe293b5eef766df186bf0d72561
959b4ffd601c6c7ff7e90c2072fb2620
2,700
PASSED
#include <bits/stdc++.h> using ll = long long; constexpr int inf = 1E9 + 5; void solve() { int n, d; std::cin >> n >> d; std::vector<std::pair<int, int>> b; for (int i = 0; i < n; i++) { int s, a; std::cin >> s >> a; if (s >= d) { b.push_back({s, a}...
C++
e1079fe293b5eef766df186bf0d72561
a933cce8b00d4ad895bb53b0dee7a2f2
2,700
PASSED
#include<bits/stdc++.h> using namespace std; const int N=5e5+10; int n,d; struct node { int s,a; bool operator < (node b) const { if(max(s,a)!=max(b.s,b.a))return max(s,a)<max(b.s,b.a); return s<b.s; } }p[N]; int main() { scanf("%d%d",&n,&d); for(int i=1;i<=n;i++)scanf("%d%d",&p[i].s,&p[i].a);...
C++
e1079fe293b5eef766df186bf0d72561
4d4b8305226c8cb55830352c3ad91c54
2,700
PASSED
#include<bits/stdc++.h> #define pii pair<int,int> #define pdd pair<double,double> using namespace std; typedef long long ll; const int MAXN = 1e6+10; const int INF = 0x3f3f3f3f; const ll mod = 1e9+7; int a[MAXN],b[MAXN]; int pre[MAXN],suff[MAXN]; int ans[MAXN]; void solve(int bl,int br,int al,int ar) { ...
C++
a8564780ff811f280453e7d28f0fc091
5a91b6699b7d4ae4954f25efc7493061
2,300
PASSED
#include<bits/stdc++.h> #define pii pair<int,int> #define pdd pair<double,double> #define lowbit(x) ((x)&(-x)) using namespace std; typedef long long ll; const int MAXN = 1e6+19; const int INF = 0x3f3f3f3f; const ll mod = 1e9+7; int a[MAXN],b[MAXN]; int pref[MAXN],suff[MAXN]; int ans[MAXN]; int n,m,sz,ss;...
C++
a8564780ff811f280453e7d28f0fc091
b029502aaa5cd9cf159a87046c52b32f
2,300
PASSED
#include<iostream> #include<stack> #include<string> #include<set> #include<map> #include<vector> #include<functional> #include<limits.h> #include<utility> #include<queue> #include<algorithm> #include<cstring> #include<iomanip> #include<bitset> #include<unordered_map> #include<fstream> #include<math.h> ...
C++
a8564780ff811f280453e7d28f0fc091
19c14f3a9deef1933c43b6617fc6619f
2,300
PASSED
#include<iostream> #include<stack> #include<string> #include<set> #include<map> #include<vector> #include<functional> #include<limits.h> #include<utility> #include<queue> #include<algorithm> #include<cstring> #include<iomanip> #include<bitset> #include<unordered_map> #include<fstream> #include<math.h> ...
C++
a8564780ff811f280453e7d28f0fc091
4ffa2e9ab6628ca1b2c64516d7430e14
2,300
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; const int maxn=2e6+7,mod=998244353 ; int t[maxn<<2],n,m,lazy[maxn<<2]; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 inline void build(int l,int r,int rt) { lazy[rt]=0; if(l==r) { t[rt]=l-1; return; } int mid=(l+r)/2; buil...
C++
a8564780ff811f280453e7d28f0fc091
b858d6d04b4446b04b73b7cd7a0c023e
2,300
PASSED
#include<bits/stdc++.h> #define For(i,a,b) for(int i=(a),i##END=(b);i<=i##END;i++) #define Rof(i,b,a) for(int i=(b),i##END=(a);i>=i##END;i--) #define go(u) for(int i=head[u];i;i=nxt[i]) #define ll long long using namespace std; inline int read() { int x; scanf("%d",&x); return x; } const int N=2e6+10; in...
C++
a8564780ff811f280453e7d28f0fc091
afcdc1caa52ec4c85fc297c7e113061a
2,300
PASSED
#include<bits/stdc++.h> #define For(i,a,b) for(int i=(a),i##END=(b);i<=i##END;i++) #define Rof(i,b,a) for(int i=(b),i##END=(a);i>=i##END;i--) #define go(u) for(int i=head[u];i;i=nxt[i]) #define ll long long using namespace std; inline int read() { int x; scanf("%d",&x); return x; } const int N=2e6+10; in...
C++
a8564780ff811f280453e7d28f0fc091
16123162e0ed893b9f9882d7a0a75d18
2,300
PASSED
#include<bits/stdc++.h> using namespace std; //#define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //#define mp make_pair //#define pb push_back #define ft first #define sc second #define ll long long #define pii pa...
C++
a8564780ff811f280453e7d28f0fc091
09f30f6441c948595f179c7865c4c164
2,300
PASSED
#include<bits/stdc++.h> using namespace std; //#define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //#define mp make_pair //#define pb push_back #define ft first #define sc second #define ll long long #define pii pa...
C++
a8564780ff811f280453e7d28f0fc091
5df0afc159cf375e16912fae7e1e8a68
2,300
PASSED
#include <bits/stdc++.h> #define GO ios::sync_with_stdio(0);cin.tie(0),cout.tie(0) using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; const ll Mod = 1e9 + 7; //998244353; const ll INF = (ll)(1e18) + 5; const ll N = 1e6 + 5; struct node { int val; int idx; node(int...
C++
a8564780ff811f280453e7d28f0fc091
52d8bf046767e7b11e2554f83f127915
2,300
PASSED
// use io::IO; #[allow(unused)] use std::cmp::*; #[allow(unused)] use std::io::*; pub fn run_case(sc: &mut Scanner, _tc: i32) { let n: usize = sc.read(); let mut l = i32::MAX; let mut r = i32::MIN; let mut l_cost = i32::MAX as i64; let mut r_cost = i32::MAX as i64; let mut joined_cost = i64::MA...
Rust
ee773d908fc297cc692aaecf6af299c9
2f7b7e4f29b5e036a3b027bee0cea26e
1,500
PASSED
// use io::IO; #[allow(unused)] use std::cmp::*; #[allow(unused)] use std::io::*; pub fn run_case(sc: &mut Scanner, _tc: i32) { let n: usize = sc.read(); let mut l = i32::MAX; let mut r = i32::MIN; let mut l_cost = i32::MAX as i64; let mut r_cost = i32::MAX as i64; let mut joined_cost = i64::MA...
Rust
ee773d908fc297cc692aaecf6af299c9
948fe22a8a73de749f9ef1130871d7e8
1,500
PASSED
// use io::IO; #[allow(unused)] use std::cmp::*; #[allow(unused)] use std::io::*; pub fn run_case(sc: &mut Scanner, out: &mut std::io::BufWriter<std::io::Stdout>, _tc: i32) { let n: usize = sc.read(); let mut l = i32::MAX; let mut r = i32::MIN; let mut l_cost = i32::MAX as i64; let mut r_cost = i32...
Rust
ee773d908fc297cc692aaecf6af299c9
615f7165fcdf959517b67d87c89c7c83
1,500
PASSED
// use io::IO; #[allow(unused)] use std::cmp::*; #[allow(unused)] use std::io::*; pub fn run_case(sc: &mut Scanner, out: &mut std::io::BufWriter<std::io::Stdout>, _tc: i32) { let n: usize = sc.read(); let mut l = i32::MAX; let mut r = i32::MIN; let mut l_cost = i32::MAX as i64; let mut r_cost = i32...
Rust
ee773d908fc297cc692aaecf6af299c9
ac25ab143cbb6784400f01eeb911a0d2
1,500
PASSED
// use io::IO; #[allow(unused)] use std::cmp::*; #[allow(unused)] use std::io::*; pub fn run_case(sc: &mut Scanner,out: &mut std::io::BufWriter<std::io::StdoutLock>, _tc: i32) { let n: usize = sc.read(); let mut l = i32::MAX; let mut r = i32::MIN; let mut l_cost = i32::MAX as i64; let mut r_cost = ...
Rust
ee773d908fc297cc692aaecf6af299c9
cbb7f6921352f59e509e8e7fa345ac22
1,500
PASSED
use io::IO; #[allow(unused)] use std::cmp::*; #[allow(unused)] use std::io::*; pub fn run_case(sc: &mut IO, _tc: i32) { let n: usize = sc.read(); let mut l = i32::MAX; let mut r = i32::MIN; let mut l_cost = i32::MAX as i64; let mut r_cost = i32::MAX as i64; let mut joined_cost = i64::MAX; f...
Rust
ee773d908fc297cc692aaecf6af299c9
cffffff514e23e00716b01814af4aafd
1,500
PASSED
//use io::IO; #[allow(unused)] use std::cmp::*; #[allow(unused)] use std::io::*; // need to import this trait use std::fmt::Write; pub fn run_case( sc: &mut scanner::Scanner, out: &mut String, _tc: i32, ) { let n: usize = sc.next(); let mut l = i32::MAX; let mut r = i32::MIN; let mut l_co...
Rust
ee773d908fc297cc692aaecf6af299c9
972e0b484314158dfc4d6cc1a45d7200
1,500
PASSED
//use io::IO; #[allow(unused)] use std::cmp::*; #[allow(unused)] use std::io::*; // need to import this trait pub fn run_case( sc: &mut scanner::Scanner, out: &mut std::io::BufWriter<std::io::StdoutLock>, _tc: i32, ) { let n: usize = sc.next(); let mut l = i32::MAX; let mut r = i32::MIN; let m...
Rust
ee773d908fc297cc692aaecf6af299c9
6c1a16c712d88d618dfa65f0fb3ca965
1,500
PASSED
//use io::IO; #[allow(unused)] use std::cmp::*; //use std::io::Write; #[allow(unused)] use std::io::*; // need to import this trait pub fn run_case(sc:&mut scanner::Scanner, out: &mut String, _tc: i32) { let n: usize = sc.next(); let mut l = i32::MAX; let mut r = i32::MIN; let mut l_cost = i32::MAX ...
Rust
ee773d908fc297cc692aaecf6af299c9
a70c45440d8172526b5a77d9193996cc
1,500
PASSED
use io::IO; #[allow(unused)] use std::cmp::*; #[allow(unused)] use std::io::*; use std::io::Write; // need to import this trait pub fn run_case(sc: &mut IO, out: &mut String, _tc: i32) { let n: usize = sc.read(); let mut l = i32::MAX; let mut r = i32::MIN; let mut l_cost = i32::MAX as i64; let mut...
Rust
ee773d908fc297cc692aaecf6af299c9
83ffb804ad3a1575bf184e81204e0f45
1,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; #define pbds tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ...
C++
96ec983bfadc9e96e36ebb8ffc5279d3
5bb47bd03cde78fb8a0127d3e59a58f7
1,700
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 pbds tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ...
C++
96ec983bfadc9e96e36ebb8ffc5279d3
ed03cd9c9969b1fa77b4b61de759f943
1,700
PASSED
#include <bits/stdc++.h> typedef long double ld; typedef long long li; using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin>>t; while(t--){ int n; cin>>n; int p[n+1]; memset(p, 0, sizeof(p)); ...
C++
96ec983bfadc9e96e36ebb8ffc5279d3
b1849539d38d1ec558a18062356b5df4
1,700
PASSED
#include "bits/stdc++.h" using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int tt = 1; cin >> tt; while (tt--) { int n...
C++
96ec983bfadc9e96e36ebb8ffc5279d3
da52867b396eef89e41d9f1c6e43834f
1,700
PASSED
//template for backtracking #include<iostream> #include<stdio.h> #include<stdlib.h> #include<map> #include<iterator> #include<string.h> #include<unordered_set> #include<unordered_map> #include<algorithm> #include<vector> #include<cmath> #include<set> #include<queue> #include<numeric> #include<list> #inc...
C++
96ec983bfadc9e96e36ebb8ffc5279d3
4ccc1280d8472b1c4ebe63dfcd42324a
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(0); #define all(a) ((a).begin()), ((a).end()) #define printarr(v, start, end)for (int _i = (start); _i < (end); _i++) cout << (v[_i]) << " ";cout << "\n"; #define log(v) for(auto __i = ((v).begin()...
C++
96ec983bfadc9e96e36ebb8ffc5279d3
a814b7b275278b204c67f407f20113b7
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(0); #define all(a) ((a).begin()), ((a).end()) #define printarr(v, start, end) \ for (int _i = (start); _i < (end); _i++) \ cout << (v[_i]) << " "; \ cout...
C++
96ec983bfadc9e96e36ebb8ffc5279d3
c43390817466ec8f1771c3ca1f3c2bbb
1,700
PASSED
#include <bits/stdc++.h> typedef long long ll; #define pb push_back #define F first #define S second #define pll pair<ll,ll> #define pii pair<int,int> #define db double #define INF 2e15 #define all(x) x.begin(), x.end() #define sz(x) x.size() #define rep(var, initial, final, increment) for(ll var = initial;v...
C++
96ec983bfadc9e96e36ebb8ffc5279d3
12da8fe8d513d2eba45b900e64361363
1,700
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> typedef long long ll; #define pb push_back #define F first #define S second #define pll pair<ll,ll> #define pii pair<int,int> #define db double #define INF 2e15 #define all(x) x.begin(), x.end() #define sz(x) x.size() #defi...
C++
96ec983bfadc9e96e36ebb8ffc5279d3
d6570998af868fece2edab86f5d6ad82
1,700
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> pbds;//A.find_by_order(x), A.order_of_key(x) #define int long long // #defi...
C++
96ec983bfadc9e96e36ebb8ffc5279d3
edfc2f3ab807337a7d22f0fe6e3982ab
1,700
PASSED
#include<iostream> using namespace std; const int maxn=1e4; char mp[maxn][maxn]; int n,m,t; int main(){ cin>>t; while(t--){ cin>>n>>m; for(int i=0;i<n;++i){ for(int j=0;j<n;++j){ mp[i][j]='.'; } } int a=0,b=0,frag=1; while(m--){ if(a>=n){ frag=0; } mp[a][b]='R'; a+=2,b+=2; } i...
C++
d5549c0627c236d82541a67ccbe7977d
c6de0ab1fb8769a30a602ab38b456782
800
PASSED
#include<iostream> #include<algorithm> #include<cmath> #define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define endl '\n' using namespace std; int a[105],b[105]; int n,m; int main(){ int t; cin >> t; while(t--){ cin >> n >> m; int x=n%2?n/2+1:n/2; if(x<m){ cout << -1 << endl; continue; } ...
C++
d5549c0627c236d82541a67ccbe7977d
951295f819ce5cab7929d906afd5e79b
800
PASSED
#include"iostream" using namespace std; int main(){ int t; cin>>t; while(t--){ int n,k; cin>>n>>k; if(k>(n+1)/2) cout<<"-1"<<endl; else{ int o=-1; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i==j&&(j-o)==2){ if(k>0){ cout<<"R"; k--; o=j; } ...
C++
d5549c0627c236d82541a67ccbe7977d
919cb16013e0472fe9c2a6711970fc94
800
PASSED
#include<iostream> #include <algorithm> using namespace std; int main() { int t; cin >> t; while (t--) { int n, k; cin >> n >> k; if (k > (n + 1) / 2) cout << -1 << endl; else { for (int i = 0; i < n; i++) { int j = i; while (j--) cout << '.'; if(i/2 < k){ if(i%2==0) cout << 'R'; els...
C++
d5549c0627c236d82541a67ccbe7977d
a0029c17443e1a73a306f928a90d07eb
800
PASSED
#include<bits/stdc++.h> using namespace std; int a[1605]; int solve(){ int n,k; cin >> n >> k; if(k > (n+1)/2) cout << -1 << endl; else{ int ii = 1,jj = 1,kk = 0; for(int i = 1;i <= n;i++){ for(int j = 1;j <= n;j++){ if(i == ii && j == jj && kk < k){ cout << "R"; ii += 2; jj += 2; ...
C++
d5549c0627c236d82541a67ccbe7977d
9b52f40a64732d6034fcff300faaca5f
800
PASSED
#include<bits/stdc++.h> using namespace std; int a[1605]; int solve(){ int n,k; cin >> n >> k; if(k == 1){ for(int i = 1;i <= n;i++){ for(int j = 1;j <= n;j++){ if(i==1&&j==1) cout << "R"; else cout << "."; } cout << endl; } return 0; } if(k > (n+1)/2) cout << -1 << endl; else{ int i...
C++
d5549c0627c236d82541a67ccbe7977d
1e623671e6c2b0208a435b4e2355f393
800
PASSED
#include<stdio.h> int main() { int i,j,k=0,l,n,m,o=0,p,s,flag; scanf("%d",&n); for(j=0;j<n;j++) { scanf("%d %d",&m,&k); if((m+1)/2<k) { printf("-1\n"); continue; } for(i=1;i<=m;i++) { for(l=1;l<=m;l++) { if(l==i&&l%2==1&&k>0) { printf("R"...
C++
d5549c0627c236d82541a67ccbe7977d
97a07615a89a04ac136568e594a4f7a9
800
PASSED
#include <iostream> using namespace std; char a[50][50]; int main(){ int t;cin >>t; while(t--){ int n,k; cin >> n>>k; if(n==1&&k==1) cout << "R"<< endl; else if(n%2 == 1){ int m =n/2+1; if(k>m) cout << -1 << endl; else{ int size=0; for(int i=1;i<=n;++i){ for(int j=1;j<=n;++j){ ...
C++
d5549c0627c236d82541a67ccbe7977d
698a68a2aa62057d1a521b3a5bc986f4
800
PASSED
#include<bits/stdc++.h> using namespace std; #define ios ios::sync_with_stdio(false) #define tie cin.tie(0),cout.tie(0) typedef long long ll; const int INF = 0x7fffffff; const int maxn = 45; int t, n, m; int main() { cin >> t; while(t--){ cin >> n >> m; if(n & 1){ if...
C++
d5549c0627c236d82541a67ccbe7977d
dc7d6d7926dc2f000079f6934fd67cd6
800
PASSED
#include <bits/stdc++.h> #define ll long long int using namespace std; const string V = "abcdefghijklmnopqrstuvwxyz"; void fun(void) { int c, d, r, n, a, b; r = 0; ll ans = 0; vector<string> v; cin >> a >> b; if (2 * (b -2)+1>( a-2)) cout << "-1" << endl; else { ...
C++
d5549c0627c236d82541a67ccbe7977d
1252ed9a59eed3d1ea390e325dc82972
800
PASSED
/* Here's to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes ... the ones who see things differently . They're not fond of rules, and they have no respect for the status quo. ... You can quote them, disagree with them, glorify or vilify them, but the only thing yo...
C++
01e728192b092cac9e0833353a3ed3f0
2972cabf7f4e3037833f572ca0be1211
2,300
PASSED
#include <bits/stdc++.h> using namespace std; int comp(pair<long long, int> a, pair<long long, int> b) { if (a.first * b.second < b.first * a.second) return 1; return 0; } void solve() { int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a...
C++
01e728192b092cac9e0833353a3ed3f0
dc0ea3adfb34e70384f8e9f9eebfb5a5
2,300
PASSED
#include <bits/stdc++.h> using namespace std; int comp(pair<long long, int> a, pair<long long, int> b) { if (a.first * b.second < b.first * a.second) return 1; return 0; } void solve() { int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a...
C++
01e728192b092cac9e0833353a3ed3f0
7d8cc3948bb4cc2926cd6d57934ec8d6
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define benq queue #define pbenq priority_queue #define all(x) x.begin(), x.end() #define sz(x) (ll)x.size() #define m1(x) memset(x, 1, sizeof(x)) #define m0(x) memset(x, 0, sizeof(x)) #define inf(x) memset(x, 0x...
C++
01e728192b092cac9e0833353a3ed3f0
f40a6c01fd46738dcf08d896f7a5d537
2,300
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; namespace IO { template <typename T> inline void read(T &x) { x=0;int y=1; char c=getchar(); while(c<'0'||c>'9'){if(c=='-')y=-1; c=getchar();} while(c>='0'&&c<='9'){x=x*10+c-'0'; c=getchar();} x*=y; return; } template <type...
C++
01e728192b092cac9e0833353a3ed3f0
5b5d206a7a6af4b97d014ffef6206c08
2,300
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; namespace IO { template <typename T> inline void read(T &x) { x=0;int y=1; char c=getchar(); while(c<'0'||c>'9'){if(c=='-')y=-1; c=getchar();} while(c>='0'&&c<='9'){x=x*10+c-'0'; c=getchar();} x*=y; return; } template <type...
C++
01e728192b092cac9e0833353a3ed3f0
905520fa16524d577f7c971e23e76829
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 1e5+2; bool isGood(pair<ll,int> a,pair<ll,int> b) { return a.first*b.second>= b.first*a.second; } bool isG(pair<ll,int> a,int b) { return a.first<= (ll)b*a.second; } int a[N]; pair<pair<ll,int>,int> ids[N],tmp[...
C++
01e728192b092cac9e0833353a3ed3f0
6c15126abb36383ff56a35aba5eedab3
2,300
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; struct Node{ int l, r; int sum, over; }tr[4 * N]; int n, m; void pushup(int u){ int l = u << 1, r = u << 1 | 1; tr[u].sum = tr[l].sum + tr[r].sum; int len1 = tr[l].r - tr[l].l + 1, len2 = tr[r].r - tr[r].l + 1; ...
C++
01e728192b092cac9e0833353a3ed3f0
b95bacf092784489b5fadcc793dee74d
2,300
PASSED
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define endl '\n' #define MASK(i) (1LL << (i)) #define ull unsigned long long #define ld long double #define pb push_back #define all(x) (x).begin() , (x).end() #define BIT(x , i) ((x >> (i)) & 1) #define TASK "task" #define sz...
C++
01e728192b092cac9e0833353a3ed3f0
7d2aacd734a52f9bc2975060d1237634
2,300
PASSED
// LUOGU_RID: 90369776 #include<bits/stdc++.h> using namespace std; #define lf long double #define N 100005// int _,n,m,a[N],p[N],d[N],e[N],f[N]; lf b[N]; pair<lf,int> B[N]; vector<int> c[N]; int main(){ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); cin>>_; while(_--){ cin>>n>>m; for(int i=1;i<=n...
C++
01e728192b092cac9e0833353a3ed3f0
74a215eb1c2c882ad6ae9ea9cc23ea54
2,300
PASSED
#include<cstdio> #include<algorithm> #define N 300001 using namespace std; int len[N],a[N]; int hz[N],sa[N],height[N],Fmin[N][21],Rank[N],c[N],b[N],cord[20][N]; int num=0,n,m; struct node { int w;long long z; }w[N]; bool cmp(node x,node y) { return x.z<y.z; } int min(int x,int y) { if (x<y) return x...
C++
7576ef94b5fc9944395ac0b1f56f9a3f
2ed9e7be21cda5b621fabcc0afc32dc8
3,500
PASSED
#include<cstdio> #include<algorithm> #define N 300001 using namespace std; int len[N],a[N]; int hz[N],sa[N],height[N],Fmin[N][21],Rank[N],c[N],b[N],cord[20][N]; int num=0,n,m; struct node { int w;long long z; }w[N]; bool cmp(node x,node y) { return x.z<y.z; } int min(int x,int y) { if (x<y) return x...
C++
7576ef94b5fc9944395ac0b1f56f9a3f
11d2ca384c996fe38b7bb6811544b071
3,500
PASSED
#include<cstdio> #include<algorithm> #define N 300001 using namespace std; int len[N],a[N]; int hz[N],sa[N],height[N],Fmin[N][21],Rank[N],c[N],b[N],cord[20][N]; int num=0,n,m; struct node { int w;long long z; }w[N]; bool cmp(node x,node y) { return x.z<y.z; } int min(int x,int y) { if (x<y) return x...
C++
7576ef94b5fc9944395ac0b1f56f9a3f
a1caff25d761d4f34cc9f95b4eb63d8b
3,500
PASSED
#include<bits/stdc++.h> #define For(i,a,b) for(int i=(a);i<=(b);++i) #define Rep(i,a,b) for(int i=(a);i>=(b);--i) //#define int long long using namespace std; inline int read() { char c=getchar();int x=0;bool f=0; for(;!isdigit(c);c=getchar())f^=!(c^45); for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48); ...
C++
7576ef94b5fc9944395ac0b1f56f9a3f
49228b5c860b3de8b96cbc95cd21dba4
3,500
PASSED
#include <stdio.h> #include <stdlib.h> #define ll unsigned long long #define se 20050117 ll ha[100010],mi[100010];int le[100010]; void lyndon(int S[100010],int n) { for(int i=0;i<n;i++)le[i]=0; int i=0,j=0,k=1; while(i<n) { if(le[k-1]==0) { int l=k-j; if((k-i)%l==0)le[k-1]=l; else le[...
C++
7576ef94b5fc9944395ac0b1f56f9a3f
6174bdec7751661b64cc95fefa58da37
3,500
PASSED
#include <cstdio> #include <cctype> #include <cstring> #include <algorithm> #include <numeric> #include <vector> #include <cassert> using namespace std; using ll = long long; using ull = unsigned long long; #define LOG(f...) fprintf(stderr, f) #define DBG(f...) printf("%3d: ", __LINE__), printf(f) // #d...
C++
7576ef94b5fc9944395ac0b1f56f9a3f
f1d056acf1065d8a785221e154aab6d3
3,500
PASSED
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector<int> a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } std::vector<std::vector<int>> b{a}; while (!std::is_sor...
C++
7576ef94b5fc9944395ac0b1f56f9a3f
d79fc3db181bb0cdc99425d415f33ab2
3,500
PASSED
#include <bits/stdc++.h> struct Tree { std::shared_ptr<Tree> l; std::shared_ptr<Tree> r; int v; int s; Tree(int v = -1) : l(nullptr), r(nullptr), v(v), s(1) {} void pull() { s = 1; if (l != nullptr) { s += l->s; } if (r != nullptr) { ...
C++
7576ef94b5fc9944395ac0b1f56f9a3f
0aef4de5f352bf76de12641289e56339
3,500
PASSED
#include<bits/stdc++.h> using namespace std; const int N=100000,C=9; int n,a[C][N+9]; void In(){ scanf("%d",&n); for (int i=1;i<=n;++i) scanf("%d",&a[0][i]); } int s[N+9],s2[N+9],p[N+9],p2[N+9],cs; void Get_a(int *a,int *b){ cs=0; for (int i=1;i<=n;++i){ for (;cs&&a[i]<s[cs-s2[cs]...
C++
7576ef94b5fc9944395ac0b1f56f9a3f
a3779f6fd0803e799199ba22f8799c94
3,500
PASSED
#include <cstdio> #include <cctype> #include <cstring> #include <algorithm> #include <numeric> #include <vector> #include <cassert> using namespace std; using ll = long long; using ull = unsigned long long; #define LOG(f...) fprintf(stderr, f) #define DBG(f...) printf("%3d: ", __LINE__), printf(f) // #d...
C++
7576ef94b5fc9944395ac0b1f56f9a3f
8d9d154595f6102ad93fd51c0acf5eb9
3,500
PASSED
#include <bits/stdc++.h> #define ll long long #define ld long double #define x first #define y second.first #define z second.second using namespace std; const ll MOD = 1e9 + 7; const ll INF = 1e9; int dl[] = {0, 0, -1, 1}; int dc[] = {1, -1, 0, 0}; int t, n, cost[502][502]; bool viz[502][502]; ll...
C++
acec4108e865c3f894de14248156abfd
3aacce9384e9993a6e6cc56cd1c4dd06
2,100
PASSED
#include<iostream> #include<queue> #define int long long using namespace std; const int N=255; const int INF=1ll*4000*1000*1000*1000*1000*1000; int dp[N*2][N*2]; int c[N*2][N*2]; int readInt () { bool minus = false; int result = 0; char ch; ch = getchar(); while (true) { ...
C++
acec4108e865c3f894de14248156abfd
d23826b6f7d9fe89f133fb849acb9631
2,100
PASSED
#include <bits/stdc++.h> #define ll long long #define Max 600 using namespace std; int T,n,a[Max][Max]; ll ans,Ans,sum[Max][Max],f[Max][Max]; int main(){ ios::sync_with_stdio(false); cin>>T; while(T--){ cin>>n; for(int i=1;i<=n*2;i++){ for(int j=1;j<=n*2;j++){...
C++
acec4108e865c3f894de14248156abfd
d0eac351f87967729eedd0c580456023
2,100
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 510; int T, n, a[maxn][maxn]; int main() { scanf("%d", &T); while (T--) { scanf("%d", &n); long long ans = 0; for (int i = 1; i <= 2 * n; i++) { for (int j = 1; j <= 2 * n; j++) { sc...
C++
acec4108e865c3f894de14248156abfd
c7930b8d86d46de485cfa9c78997449c
2,100
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t;cin>>t; while(t--){ int n;cin>>n;long long k=0; long m; vector<vector<long>>vec; for(int i=0;i<2*n;i++){ vector<long>v; for(int j=0;j<2*n;j++){ long p;c...
C++
acec4108e865c3f894de14248156abfd
676d3619f8a00163cce1d626e08191f7
2,100
PASSED
//D - The Winter Hike #include<iostream> #include<vector> #include<algorithm> using namespace std; long long a[505][505]; int main(){ long long ans,t,n; cin>>t; while(t--){ cin>>n;ans=0; // vector<vector<long long> > a(2*n+1,vector<long long>(2*n+1)); // long long a[255][255]; //��������ᳬʱ ...
C++
acec4108e865c3f894de14248156abfd
9df48643a3b1b59714da95fe6e15fdfb
2,100
PASSED
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ long long ans,t,n; cin>>t; while(t--){ cin>>n;ans=0; vector<vector<long long> > a(2*n+1,vector<long long>(2*n+1)); // long long a[255][255]; for(int i=1;i<=2*n;i++) for(int j=1;j<=2*n;j++) cin>>a[i][j]...
C++
acec4108e865c3f894de14248156abfd
2fbde86f1fe9603bdcb0d7f04639fe83
2,100
PASSED
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long ans,t,n; cin>>t; while(t--){ cin>>n; vector<vector<long long> > a(2*n+1,vector<long long>(2*n+1)); for(int i=1;i<=2*n;i++){ for(int j=1;j...
C++
acec4108e865c3f894de14248156abfd
febca464b71be84bb59ea413d871104c
2,100
PASSED
// JAI BAJARANG BALI // manitianajay45 // give me some sunshine, give me some rain, give me another chance to grow up once again // sab moh maya hai.... // waiting.... #include<bits/stdc++.h> using namespace std; #define ll unsigned long long int main(){ ll t; cin>>t; // t=1; w...
C++
acec4108e865c3f894de14248156abfd
21ebe2069a3ecad25f85a9d731f09f3b
2,100
PASSED
#include<bits/stdc++.h> #define N 505 #define min8(a1,a2,a3,a4,a5,a6,a7,a8) min(min(min(a1,a2),min(a3,a4)),min(min(a5,a6),min(a7,a8))) using namespace std; int t,n,c[N][N]; bool vst[N][N]; long long dis[N][N]; int dx[10]={0,0,0,1,-1}; int dy[10]={0,1,-1,0,0}; struct node { int x,y; long long val; bool o...
C++
acec4108e865c3f894de14248156abfd
6a0be82869d67b97159fc6a866b5d30d
2,100
PASSED
#include<bits/stdc++.h> using namespace std; long long T,a,b[2],c,d[2]; char s[1000001]; struct p{long long q,fl;}; vector<p> qu[2],qu1[2]; bool cmp(p qq,p ww){if(qq.fl==ww.fl) return qq.q<ww.q;return qq.fl<ww.fl;} long long work(long long qq) { long long ann=0; qu[0]=qu1[0],qu[1]=qu1[1]; d[0]=d[1]=0; l...
C++
a4647cced2dc6adcb0b8abc24f2d7dce
85cb1d642e967f0d589935175f34f942
2,700
PASSED
#include<bits/stdc++.h> using namespace std; int n,a,b,c,d[2],e[2]; vector<vector<int> >g; vector<int>f; char s[100005]; int main() { int t; scanf("%d",&t); while(t--) { scanf("%d%d%d%d\n%s",&n,&a,&b,&c,s); d[0]=d[1]=0; e[0]=e[1]=0; g.clear(); for(int i=0; i<n; i++) { if(s[i]=='0') { ...
C++
a4647cced2dc6adcb0b8abc24f2d7dce
f506a480c8e87f892ba46cd0a4a5628a
2,700
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int N = 1e5+10; int T,n,a,b,c; int tot,f,bk,ans,coun,at[N]; vector <int> nu; inline int read() { int x=0; char c=getchar(); while(c<'0'||c>'9') { c=getchar(); } while(c>='0'&&c<='9') { x=(x<<1)+(x<<3)+(c^48); ...
C++
a4647cced2dc6adcb0b8abc24f2d7dce
8fdff8364458a4cff2bb96425adb4fa3
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define uu unsigned #define fre(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout) #define scanf abc=scanf #define forg(i,x) for(int i=fir[x];i;i=nxt[i]) int abc; typedef long long ll; typedef uu long long ull; typedef pair<int,int>pii; typedef vector<int>V...
C++
a4647cced2dc6adcb0b8abc24f2d7dce
f479c4fc5c49578cd9e274899304b1b9
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define uu unsigned #define fre(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout) #define scanf abc=scanf #define forg(i,x) for(int i=fir[x];i;i=nxt[i]) int abc; typedef long long ll; typedef uu long long ull; typedef pair<int,int>pii; typedef vector<int>V...
C++
a4647cced2dc6adcb0b8abc24f2d7dce
47b84d515dec29cd9eaadd838b494d5e
2,700
PASSED
#include <bits/stdc++.h> using namespace std; long long n,a,b,c; string S; int vis[100005]; long long c0,c1,c00,c11,c01,c02; int cnt; long long work(int s){ long long ans = 0,now = 0; c02 = c0 - c01 - c00; assert(c02 <= 2&&c02>=0); c01 = 0;cnt = 0; while (1){ s ^= 1; ans = max(ans,now); if ...
C++
a4647cced2dc6adcb0b8abc24f2d7dce
e3b7245f15ebb3223a6e66deec4e7ea5
2,700
PASSED
//小号转大号提交 #include<bits/stdc++.h> using namespace std; #define N 100003 #define LL long long #define INF 0x3f3f3f3f int T,n,h[N],cnt1,l0,r0,bkpl,bkpr,bkpc; LL a,b,c; vector<int>h0,bkp; LL calc(int tp){ h0=bkp,l0=bkpl,r0=bkpr,cnt1=bkpc; LL cur=0,ans=0; while(1){ if(tp){ int p2=lower_bound(h0.begin(),h0.end(),2)-...
C++
a4647cced2dc6adcb0b8abc24f2d7dce
517fc435d82cab76345817dec4f5b211
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define N 100003 #define LL long long #define INF 0x3f3f3f3f int T,n,h[N],cnt1,l0,r0,bkpl,bkpr,bkpc; LL a,b,c; vector<int>h0,bkp; LL calc(int tp){ h0=bkp,l0=bkpl,r0=bkpr,cnt1=bkpc; LL cur=0,ans=0; while(1){ if(tp){ int p2=lower_bound(h0.begin(),h0.end(),2)-h0.begin()...
C++
a4647cced2dc6adcb0b8abc24f2d7dce
a1a6c5f1c443cf9a4d2355c2a96bd5fe
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define N 100003 #define LL long long #define INF 0x3f3f3f3f int T,n,h[N],cnt1,l0,r0,bkpl,bkpr,bkpc; LL a,b,c; vector<int>h0,bkp; LL calc(int tp){ h0=bkp,l0=bkpl,r0=bkpr,cnt1=bkpc; LL cur=0,ans=0; while(1){ if(tp){ int p2=lower_bound(h0.begin(),h0.end(),...
C++
a4647cced2dc6adcb0b8abc24f2d7dce
1f5d860b0b6dc833408a8d90eda3a54f
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int T, n, a, b, c; char s[maxn]; int main() { scanf("%d", &T); while (T--) { scanf("%d %d %d %d %s", &n, &a, &b, &c, s + 1); if (n == 1) { puts("0"); continue; } int num0 = 0, num1 = 0, len1 = 0, len2 = ...
C++
a4647cced2dc6adcb0b8abc24f2d7dce
9825f58a4a332ff485f5d5d66fefc028
2,700
PASSED
#include <iostream> #include <fstream> #include <vector> #include <utility> #include <cstring> #include <algorithm> #include <cmath> #include <string> #include <queue> #include <deque> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <stack> #include <iomanip> #in...
C++
d8467d78c638a379fc9a6537064b1f22
be3bda9189cde9105d2eb1240e28a846
3,200
PASSED
//#pragma GCC optimize("O0") #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <complex> #include <cstdlib> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <li...
C++
d8467d78c638a379fc9a6537064b1f22
0086a1290c1e5c276511bc492107668f
3,200
PASSED
//#pragma GCC optimize("O0") #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <complex> #include <cstdlib> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <li...
C++
d8467d78c638a379fc9a6537064b1f22
08c518246f468c72c897d0f241487f19
3,200
PASSED
//#pragma GCC optimize("O0") #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <complex> #include <cstdlib> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <li...
C++
d8467d78c638a379fc9a6537064b1f22
c1c5e52af8a4b19f133e92f037619273
3,200
PASSED