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 <cstdio> #include <vector> #include <algorithm> #define pb push_back using std::vector; const int N=305, MOD=1000000007; inline int mval(int x) { return x>=MOD?x-MOD:x; } inline int fix(int x) { return x+(x>>31&MOD); } inline void inc(int &x, int a) { x=mval(x+a); } inline void dec(int &x, int a) { x=...
C++
c11a4d0fb5ce48af19aa7583559ed269
dfabf52fa185fecdbaf8c7449f8e818f
3,500
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = long double; // or double, if TL is tight using str = string; // yay python! using pi = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; ...
C++
c11a4d0fb5ce48af19aa7583559ed269
40236c27bf8e9f1741a97b939aaa0974
3,500
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = long double; // or double, if TL is tight using str = string; // yay python! using pi = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; ...
C++
c11a4d0fb5ce48af19aa7583559ed269
4d475264bf0a4ec22b601a83832599bf
3,500
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = long double; // or double, if TL is tight using str = string; // yay python! using pi = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; ...
C++
c11a4d0fb5ce48af19aa7583559ed269
41298f52d4fcd86b2766ccbf8303d65d
3,500
PASSED
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=(a),_=(b);i<=_;++i) #define per(i,a,b) for(int i=(a),_=(b);i>=_;--i) #define pb push_back #define IL inline using namespace std; typedef long long ll; typedef unsigned int ui; typedef unsigned long long ul; typedef double db; typedef vector<int> VI; //he...
C++
c11a4d0fb5ce48af19aa7583559ed269
2770e1360b40c7b4c2ba0ca0b2cc6dc2
3,500
PASSED
#include<bits/stdc++.h> using namespace std; const int N=305; const int K=1005; const int mo=1000000007; int n,Q; int a[N],d[N],e[N][N]; int M[N][N],V[N][N],SV[N][N]; int tr[N][N],VP[K][N],IVP[K][N]; int power(int x,int y){ int s=1; for (;y;y/=2,x=1ll*x*x%mo) if (y&1) s=1ll*s*x%mo; return s; } voi...
C++
c11a4d0fb5ce48af19aa7583559ed269
801f9bc6875996eb03ca5ae07fcd9ae4
3,500
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t;cin>>t; while(t--){ int n;cin>>n; int count=0; set<int> a; // a.max_load_factor(.25); // a.reserve(512); for(int...
C++
06212223295c56a78a5d4e55c53a63e0
adbfef10b1dfa8a78b481e81fdb4b87e
900
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t;cin>>t; while(t--){ int n;cin>>n; int count=0; unordered_set<int> a; a.max_load_factor(.25);// a.reserve(512); f...
C++
06212223295c56a78a5d4e55c53a63e0
706ba4031a9a874e0f9b0acca0a76a0f
900
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t;cin>>t; while(t--){ int n;cin>>n; int count=0; unordered_set<int> a; // a.max_load_factor(.01); a.reserve(512); ...
C++
06212223295c56a78a5d4e55c53a63e0
c4510f19708245e5a58df030bb1cd41b
900
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t;cin>>t; while(t--){ int n;cin>>n; int count=0; unordered_set<int> a; a.max_load_factor(.01); // a.reserve(512);sets ...
C++
06212223295c56a78a5d4e55c53a63e0
a9254eb9702cbdcc55a66b05d8622b88
900
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t;cin>>t; while(t--){ int n;cin>>n; int count=0; unordered_set<int> a; a.max_load_factor(.1); // a.reserve(512);sets ...
C++
06212223295c56a78a5d4e55c53a63e0
44cceec8ffbeab757f6660ebe09547bc
900
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t;cin>>t; while(t--){ int n;cin>>n; int count=0; unordered_set<int> a; a.max_load_factor(.25); // a.reserve(512);sets ...
C++
06212223295c56a78a5d4e55c53a63e0
122226ee3677a02d72f27147eb8082a0
900
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t;cin>>t; while(t--){ int n;cin>>n; int count=0; unordered_set<int> a; a.max_load_factor(.49); // a.reserve(512);sets ...
C++
06212223295c56a78a5d4e55c53a63e0
2f5728ce1588505a7bbb6eba82f904f4
900
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t;cin>>t; while(t--){ int n;cin>>n; int count=0; unordered_set<int> a; a.max_load_factor(.5); // a.reserve(512);sets ...
C++
06212223295c56a78a5d4e55c53a63e0
36eecca927203c61270e8ea9da69023d
900
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t;cin>>t; while(t--){ int n;cin>>n; int count=0; unordered_set<int> a; a.max_load_factor(.51); // a.reserve(512); ...
C++
06212223295c56a78a5d4e55c53a63e0
f38a955c60731fe02931c9526ca6ddef
900
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t;cin>>t; while(t--){ int n;cin>>n; int count=0; unordered_set<int> a; a.max_load_factor(.5); // a.reserve(512); f...
C++
06212223295c56a78a5d4e55c53a63e0
5218f2f7a58b501c1d79fb6f4c6c4506
900
PASSED
#include <bits/stdc++.h> //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") using namespace std; #define x first #define y second #define pb push_back #define all(a) a.begin(),a.end() #define int long long typedef long long ll; typedef long double ld; typedef unsigned long long ull;...
C++
a88199a7adfe27866922a51f7bcc7367
ba9476e03f52322c130d0cd51821b032
2,000
PASSED
#include <bits/stdc++.h> //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") using namespace std; #define x first #define y second #define pb push_back #define all(a) a.begin(),a.end() #define int long long typedef long long ll; typedef long double ld; typedef unsigned long long ull;...
C++
a88199a7adfe27866922a51f7bcc7367
15506d0ae707f18b862436141b201bc3
2,000
PASSED
#include <bits/stdc++.h> //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") using namespace std; #define x first #define y second #define pb push_back #define all(a) a.begin(),a.end() #define int long long typedef long long ll; typedef long double ld; typedef unsigned long long ull;...
C++
a88199a7adfe27866922a51f7bcc7367
ea00d0059d98f27b0cee685195894fa2
2,000
PASSED
#include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> #include<math.h> #include<queue> #include<stack> #include<set> #include<bitset> #include<map> #include<vector> #define ll long long #define bug cout<<"bug"<<endl; //priority_queue <int,vector<int>,greater<int> > q; //priority_queu...
C++
a88199a7adfe27866922a51f7bcc7367
2f4197da406bc69bfd94687d249706b0
2,000
PASSED
#include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> #include<math.h> #include<queue> #include<stack> #include<set> #include<bitset> #include<map> #include<vector> #define int long long #define bug cout<<"bug"<<endl; //priority_queue <int,vector<int>,greater<int> > q; //priority_que...
C++
a88199a7adfe27866922a51f7bcc7367
4747d1590902a29aaf89835a03a41253
2,000
PASSED
//#pragma comment(linker, "/stack:20000000") #pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define se second #define fi first #define ss size() #define pb push_back #define mp make_pair #defin...
C++
a88199a7adfe27866922a51f7bcc7367
188364d79057a5df39cf61efdd782400
2,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ vector<pair<ll, ll>> r; vector<ll> d; vector<ll> a, a1; ll T; cin >> T; for(ll q = 0; q < T; q++){ ll n; cin >> n; r.clear(); d.clear(); a.clear(); a1.clear(); a.resize(n); a1.resize(n+1); ...
C++
a88199a7adfe27866922a51f7bcc7367
e3188a99df69b79928605d2bec3262a3
2,000
PASSED
#include <iostream> #include <cstring> #include <vector> #include <map> using namespace std; typedef long long ll; typedef unsigned long long ull; const ll N = 2e5 + 5, M = 1e2 + 5; const char cr = 10, sp = 32; const ll inf = 0x3f3f3f3f; struct opt { ll p, c; }; vector<opt> option; vector<ll> an...
C++
a88199a7adfe27866922a51f7bcc7367
8f73cf86339d7a445e84f50b280683e8
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define sf(n) scanf("%d",&n) #define rep(i,a,b) for(int i=a;i<=b;i++) #define eb emplace_back const int N=5e2+5; int a[N],n,nowlen; vector<pair<int,int> >ans; vector<int>ans2; unordered_map<int,int>mp; void reverse1(int pos){ for(int i=1;i<=pos;i++){ ans.eb(po...
C++
a88199a7adfe27866922a51f7bcc7367
f70f065f15094f6870fda28e86472194
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>; #define stup ios_base::sync_with_stdio(false...
C++
a88199a7adfe27866922a51f7bcc7367
7201dbe83a5d41584e8fe2af9687ba32
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int tt; cin>>tt; while(tt--){ int x1,x2,x3,y1,y2,y3; cin>>x1>>y1>>x2>>y2>>x3>>y3; int mx=max(y1,max(y2,y3)); int ans=0; if(y1==y2&&y1==mx) ans+=abs(x1-x2); if(y2==y3&&y2=...
C++
9f019c3898f27d687c5b3498586644e8
a2eddb0e9c2e4e030c82d02e29d01c66
800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); ll t;cin>>t; while(t--) { int ax,ay,bx,by,cx,cy; cin>>ax>>ay>>bx>>by>>cx>>cy; if((ay==by && ay>cy) || (ay==cy && ay>by) || (by==cy && by>ay) )...
C++
9f019c3898f27d687c5b3498586644e8
4db430a278d7b344e91a5cd204fc94fa
800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define mod 1000000007 #define endl '\n' #define pb push_back #define fr(i, a, b) for (ll i = a; i < b; i++) #define rf(i, a, b) for (ll i = a; i >= b; i--) #define mx(arr) *max_element(arr,arr+n); #define mn(arr) *min_element(arr,arr+n); #def...
C++
9f019c3898f27d687c5b3498586644e8
52099dfb6b249d72330a0c34154b6975
800
PASSED
#include<bits/stdc++.h> using namespace std; void solve() { int x1, y1, x2, y2, x3, y3, ans = 0; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; if(y1 == y2 && y3 < y1) ans = abs(x1-x2); else if(y1 == y3 && y2 < y1) ans = abs(x1-x3); else if(y2 == y3 && y1 < y2) ans = abs(x2-x3); cout << ans << endl; } int main()...
C++
9f019c3898f27d687c5b3498586644e8
6524ce92c235569a66a8e4cf82045ec9
800
PASSED
#include <bits/stdc++.h> using namespace std; struct Node { int x,y; }; bool cmp(Node l,Node r) { return l.y<r.y; } void solve() { Node nodes[4]; for(int i=1;i<=3;i++) { cin>>nodes[i].x>>nodes[i].y; } sort(nodes+1,nodes+4,cmp); if(nodes[2].y==nodes[3].y) cout << abs(nodes[2].x-nodes[3].x) <<...
C++
9f019c3898f27d687c5b3498586644e8
dc242024a4805cf79fc59f56c9be4bfe
800
PASSED
#include<bits/stdc++.h> using namespace std; int t; struct T{ int x,y; bool operator<(T t){return y<t.y;} }a[3]; int main(){ cin>>t; while(t--){ for(int i=0;i<3;i++)cin>>a[i].x>>a[i].y; sort(a,a+3); cout<<(a[1].y==a[2].y?abs(a[1].x-a[2].x):0)<<endl; } }
C++
9f019c3898f27d687c5b3498586644e8
4630f568f504c2c1d59148a3eb00b758
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int T; cin>>T; while(T--) { int x[4],y[4]; for(int i=1;i<=3;i++) { cin>>x[i]>>y[i]; } for(int i=1;i<3;i++) { for(int j=i+1;j<=3;j++) { if(y[i]>y[j]) { swap(x[i],x[j]); swap(y[i],y[j]); }else if(...
C++
9f019c3898f27d687c5b3498586644e8
add342a51dc873ee739aebbdc981f426
800
PASSED
#include<bits/stdc++.h> using namespace std; struct zzz{ int x,y; }a[4]; bool cmp(zzz m,zzz n){ return m.y<n.y; } int t,LS; int CCLT(zzz m,zzz n){ LS=sqrt( pow( (m.x-n.x),2 ) + pow( (m.y-n.y),2 ) ); return LS; } signed main(){ ios::sync_with_stdio(false); cin>>t; while(t--){ mems...
C++
9f019c3898f27d687c5b3498586644e8
bf8ba7424eb2a746b9f12820fec09545
800
PASSED
#include<bits/stdc++.h> using namespace std; struct zzz{ int x,y; }a[4]; bool cmp(zzz m,zzz n){ return m.y<n.y; } int t,LS; int CCLT(zzz m,zzz n){ LS=sqrt( pow( (m.x-n.x),2 ) + pow( (m.y-n.y),2 ) ); return LS; } signed main(){ ios::sync_with_stdio(false); cin>>t; while(t--){ mems...
C++
9f019c3898f27d687c5b3498586644e8
d3ab7609b2ea10cdb11af04bffbcff36
800
PASSED
/* Writer:ZhengXiangYu Time: Problem | Things: Web: Nothing Note: Nothing */ #include <bits/stdc++.h> #define IOS std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0) #define fre(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout) using i64 = long long; constexpr i64 eps = 1e-9; ...
C++
9f019c3898f27d687c5b3498586644e8
b6ccaa7d6b28b815a9b09ab00cd3ca94
800
PASSED
#include<bits/stdc++.h> using namespace std; const int N=2e5+100; int t,n,x,a[N]; int main() { cin>>t; while(t--) { map<int,int> m; cin>>n>>x; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); m[a[i]]++; } sort(a+1,a+n+1); ...
C++
c19500d867fd0108fdeed2cbd00bc970
aa4af24f5508cc4b448aae6e335c93ab
1,200
PASSED
#include<bits/stdc++.h> using namespace std; const int N=2e5+100; int t,n,x,a[N],cnt=0; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>t; while(t--) { map<int,int> m; cin>>n>>x; for(int i=1;i<=n;i++) { cin>>a[i]; ...
C++
c19500d867fd0108fdeed2cbd00bc970
89049e0e1bcfbdb96451d2ec1e48406b
1,200
PASSED
#include <bits/stdc++.h> #define endl '\n' #define INF 2147483647 using namespace std; typedef long long ll; const int N=200001; const int mod=1e9+7; ll a[N],b[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t,n,i,j; cin>>t; while(t--) { int x; cin>>n>>...
C++
c19500d867fd0108fdeed2cbd00bc970
d089e62f349d45359d2c289b0e57082d
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n,x; cin>>n>>x; long long int arr[n+2]; for(int i=0; i<n; i++) { cin>>arr[i]; } long long int ans=0; sort(arr,arr+n); ...
C++
c19500d867fd0108fdeed2cbd00bc970
be2e7ccf6e93ece06519c37f08655dad
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int int main() { int t; cin>>t; while(t--) { int n,x; cin>>n>>x; vector<ll>a(n); for(int i=0;i<n;i++) { cin>>a[i]; } sort(a...
C++
c19500d867fd0108fdeed2cbd00bc970
0689c54c50638a504a695c1c36096523
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int //STL : #define vi vector<int> #define vb vector<bool> #define vs vector<string> #define vl ...
C++
c19500d867fd0108fdeed2cbd00bc970
7891185da703e57c1572b6cf4cac2ac1
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int //STL : #define vi vector<int> #define vb vector<bool> #define vs vector<string> #define vl ...
C++
c19500d867fd0108fdeed2cbd00bc970
593b7c9a3fac44bda44793c0f7a93cb7
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int //STL : #define vi vector<int> #define vb vector<bool> #define vs vector<string> #define vl ...
C++
c19500d867fd0108fdeed2cbd00bc970
98a8aeb8bbef5699b390e477311f1589
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int //STL : #define vi vector<int> #define vb vector<bool> #define vs vector<string> #define vl ...
C++
c19500d867fd0108fdeed2cbd00bc970
cd73ead4e12d58648467012d3e702f74
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int //STL : #define vi vector<int> #define vb vector<bool> #define vs vector<string> #define vl ...
C++
c19500d867fd0108fdeed2cbd00bc970
e4fe3c055d05cadff05083f85f796abf
1,200
PASSED
#include<iostream> #include<vector> #include<cstring> using namespace std; typedef pair<int,int> pii; typedef pair<pii,int> piii; const int num=2e5+10; int inv[num],inx[num]; int inc[num];//ๆ•ฐๅญ— int inc_time[num];//ๆ—ถ้—ด vector<piii> box; //t=0 vector<pii> ques; vector<int> ques_tool; int yuii=0; int res...
C++
b618c6067c966e0ca846ea463300df75
504f2dd3e33ff2a13d4cb3f9075fa400
2,200
PASSED
#include<cstdio> #include<algorithm> #include<cstring> #include<cassert> const int Q=200005; const int INF=(1<<30); typedef long long ll; #define rg register int #define cint const register int //char Buf[1<<21],*p1=Buf,*p2=Buf; //#define gc() (p1==p2&&(p2=(p1=Buf)+fread(Buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) ...
C++
b618c6067c966e0ca846ea463300df75
4bbccb49b729a61c3ba894b71ce8b109
2,200
PASSED
#include<cstdio> #include<algorithm> #include<cstring> #include<cassert> const int Q=200005; const int INF=(1<<30); typedef long long ll; #define rg register int #define cint const register int //char Buf[1<<21],*p1=Buf,*p2=Buf; //#define gc() (p1==p2&&(p2=(p1=Buf)+fread(Buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) ...
C++
b618c6067c966e0ca846ea463300df75
e4448405243fd3daf5d266bf55d0ca5a
2,200
PASSED
#include<iostream> #include<vector> #include<algorithm> #include<set> using namespace std; struct req { int t, l, r, x, j; }; struct node { int l, r, mid; int mx; }; req task[200001]; node tree[800001]; int ans[200001], app[200001]; int n; void build(int l, int r, int idx = 1) { tree[idx].l = l, tr...
C++
b618c6067c966e0ca846ea463300df75
a1069c1010b612ebd102dfc0288aa749
2,200
PASSED
#include<iostream> #include<vector> #include<algorithm> #include<set> using namespace std; int mn[200002], fa[200002]; int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); } int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n, q; cin >> n >> q; for (int i = 1; i <= n ...
C++
b618c6067c966e0ca846ea463300df75
2777da761a90334b7b7f22fc496a00f4
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define dbg(x...) \ do { \ cout << #x << " -> ";\ err(x); \ } while (0) void err() { cout << endl; } template <class T, class... Ts> void err(const T& arg, const...
C++
b618c6067c966e0ca846ea463300df75
de32b650086a0770d65ce3add4f551a8
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define dbg(x...) \ do { \ cout << #x << " -> ";\ err(x); \ } while (0) void err() { cout << endl; } template <class T, class... Ts> void err(const T& arg, const...
C++
b618c6067c966e0ca846ea463300df75
8c1d32e988d9d6c0af3e52fbb9f391d2
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define dbg(x...) \ do { \ cout << #x << " -> ";\ err(x); \ } while (0) void err() { cout << endl; } template <class T, class... Ts> void err(const T& arg, const...
C++
b618c6067c966e0ca846ea463300df75
321e462a874fffebaf4de8ce55fcf505
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define dbg(x...) \ do { \ cout << #x << " -> ";\ err(x); \ } while (0) void err() { cout << endl; } template <class T, class... Ts> void err(const T& arg, const...
C++
b618c6067c966e0ca846ea463300df75
5f873ab411bbfff156465d75bbc7862d
2,200
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 200005; int n; int q; const int INF = 1e9+7; int t[N << 2]; void update(int v, int tl, int tr, int pos, int new_val) { if (tl == tr) { t[v] = min(t[v], new_val); } else { int tm = (tl + tr) / 2; if (pos <= tm)...
C++
b618c6067c966e0ca846ea463300df75
9d6b72ab294ac511c635579cef58969b
2,200
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long LL; int main(){ ios::sync_with_stdio(0); srand((unsigned)time(NULL)); int n, m, T = 19; cin >> n >> m; const int mod = 1e9 + 7; vector<vector<int>> a(n, vector<int>(m + 1)); for(int i = 0; i < n; i++){ for(int j ...
C++
282a2f110ab3c0ab7853e7c427e26552
767a7f60980a2234da07def02ded3e6f
2,700
PASSED
#define debug(a) cout << #a << " = " << a << endl; #define debug2(a,b) cout<<#a<<" = "<<a<<' '<<#b<<" = "<<b<<endl; #define debug3(a,b,c) cout<<#a<<" = "<<a<<' '<<#b<<" = "<<b<<' '<<#c<<" = "<<c<<endl; #define debug4(a,b,c,d) cout<<#a<<" = "<<a<<' '<<#b<<" = "<<b<<' '<<#c<<" = "<<c<<' '<<#d<<" = "<<d<<endl; #define...
C++
282a2f110ab3c0ab7853e7c427e26552
35644fb9223de6ef6030e0479706a07c
2,700
PASSED
#define debug(a) cout << #a << " = " << a << endl; #define debug2(a,b) cout<<#a<<" = "<<a<<' '<<#b<<" = "<<b<<endl; #define debug3(a,b,c) cout<<#a<<" = "<<a<<' '<<#b<<" = "<<b<<' '<<#c<<" = "<<c<<endl; #define debug4(a,b,c,d) cout<<#a<<" = "<<a<<' '<<#b<<" = "<<b<<' '<<#c<<" = "<<c<<' '<<#d<<" = "<<d<<endl; #define...
C++
282a2f110ab3c0ab7853e7c427e26552
05662a38206aea9b8cfd72336f8a490d
2,700
PASSED
#include <bits/stdc++.h> #define f first #define s second #define vec vector #define pb push_back #define sz(x) (int)(x).size() #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define m_p make_pair //#pragma GCC optimize("-O3") //#pragma GCC optimize("unroll-loops") using nam...
C++
282a2f110ab3c0ab7853e7c427e26552
8923ed7025b72d58e49c723aadf3fb5f
2,700
PASSED
#include <bits/stdc++.h> #define f first #define s second #define vec vector #define pb push_back #define sz(x) (int)(x).size() #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define m_p make_pair //#pragma GCC optimize("-O3") //#pragma GCC optimize("unroll-loops") using nam...
C++
282a2f110ab3c0ab7853e7c427e26552
4fa668460fade28b0cd39d0da2426442
2,700
PASSED
#include <bits/stdc++.h> #define f first #define s second #define vec vector #define pb push_back #define sz(x) (int)(x).size() #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define m_p make_pair //#pragma GCC optimize("-O3") //#pragma GCC optimize("unroll-loops") using nam...
C++
282a2f110ab3c0ab7853e7c427e26552
941c465a4e8cb6d3b31ff31cbf379caa
2,700
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define all(m) (m).begin(), (m).end() #define rall(m) (m).rbegin(), (m).rend() #define vec vector #define mp make_pair #define sz(a) (int) (a).size() typ...
C++
282a2f110ab3c0ab7853e7c427e26552
d07b4a7d1ce25b209118d73539c6fd54
2,700
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define all(m) (m).begin(), (m).end() #define rall(m) (m).rbegin(), (m).rend() #define vec vector #define mp make_pair #define sz(a) (int) (a).size() typ...
C++
282a2f110ab3c0ab7853e7c427e26552
c4270643af88d954275b9cbccbc8ad0f
2,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 fi first #define se second #define all(m) (m).begin(), (m).end() #define rall(m) (m).rbegin(), (m).rend() #define vec vector #define mp make_pair ...
C++
282a2f110ab3c0ab7853e7c427e26552
120b7e26ba1e45c67b6acf7f2cb50d47
2,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 fi first #define se second #define all(m) (m).begin(), (m).end() #define rall(m) (m).rbegin(), (m).rend() #define vec vector #define mp make_pair ...
C++
282a2f110ab3c0ab7853e7c427e26552
49ed9c004015021a510c0af3d077426f
2,700
PASSED
#include <iostream> #include <algorithm> #include <map> #include <stdio.h> #define int long long using namespace std; int32_t main() { int n; cin>>n; while(n != 0) { int x,y; int t; map<int,int> mp; int k, l; cin >> x >> y; for(int i = 0; i < x; i++) {...
C++
eee23388aa7cda50302fc4da6e50e172
675a4e594ec731ac17aacb38860560bb
800
PASSED
#include<bits/stdc++.h> using namespace std; char b[110]; int t,n,m,x; int main() { cin>>t; while(t--) { cin>>n>>m; fill(b+1,b+m+1,'B');//ๅกซๅ……ๅ‡ฝๆ•ฐ while(n--) { cin>>x; if(x<m+1-x) { if(b[x]!='A')//ๅฆ‚ๆžœ่ฟ™ไธชไฝ็ฝฎๅทฒ็ปๆœ‰ไบ†๏ผŒ้‚ฃๅฐฑๅช่ƒฝ้€‰ๆ‹ฉๅฆไธ€ไธชไบ† b[x]='A'...
C++
eee23388aa7cda50302fc4da6e50e172
92e5ae4b8e9fc99e2c9ed8497d110115
800
PASSED
#include<iostream> using namespace std; char b[110]; int t,n,m,x; int main() { cin>>t; while(t--) { cin>>n>>m; fill(b+1,b+m+1,'B');//ๅกซๅ……ๅ‡ฝๆ•ฐ while(n--) { cin>>x; if(x<m+1-x) { if(b[x]!='A')//ๅฆ‚ๆžœ่ฟ™ไธชไฝ็ฝฎๅทฒ็ปๆœ‰ไบ†๏ผŒ้‚ฃๅฐฑๅช่ƒฝ้€‰ๆ‹ฉๅฆไธ€ไธชไบ† b[x]='A'; ...
C++
eee23388aa7cda50302fc4da6e50e172
2d68145ce68bd6cd1fa91369dbc8ab4f
800
PASSED
#include <cstdio> #include <iostream> #include <cstring> using namespace std; int t; int n,m; int s[55]; int main() { scanf("%d",&t); while(t--) { memset(s,0,sizeof(s)); scanf("%d%d",&n,&m); int a; for(register int i=1;i<=n;i++) { scanf("%d",&a); if(s[a]) s[m+1-a]=1; else if(s[m+1-a]) s...
C++
eee23388aa7cda50302fc4da6e50e172
6ad00187723e45d27da69d60cb6ac14b
800
PASSED
#include<iostream> #include<string> using namespace std; int main() { int t; cin>>t; while(t--) { int m,n; cin>>n>>m; string str(m+1,'B'); int *arr=new int [n+1]; for(int i=1;i<=n;i++) cin>>arr[i]; for(int i=1;i<=n;i++) { int a=arr[i], b=m+1-arr[i]; if(a<b&&str[a]=='B'||a>b&&str[b]=='A') ...
C++
eee23388aa7cda50302fc4da6e50e172
01f2ea206b9afd157b3f906c0d32ddce
800
PASSED
#include<iostream> using namespace std; char b[110]; int t,n,m,x; int main() { cin>>t; while(t--) { cin>>n>>m; fill(b+1,b+m+1,'B'); while(n--) { cin>>x; if(x<m+1-x) { if(b[x]!='A') b[x]='A'; else b[m+1-x]='A'; ...
C++
eee23388aa7cda50302fc4da6e50e172
40616c147976de58d47063ac7b2308af
800
PASSED
#include<iostream> using namespace std; char str[110]; int t,n,m,x; int main() { cin>>t; while(t--) { cin>>n>>m; fill(str+1,str+m+1,'B'); while(n--) { cin>>x; if(x<m+1-x) { if(str[x]!='A') str[x]='A'; else ...
C++
eee23388aa7cda50302fc4da6e50e172
493a22f0a3f6405e7b4d1fd9ae094652
800
PASSED
#include<iostream> #include<algorithm> #include<cstring> #include<cmath> #define endl '\n' using namespace std; int n,m,t; char str[55]; void solve(){ cin>>n>>m; for(int i=1;i<=m;i++) str[i]='B'; int x; for(int i=1;i<=n;i++){ cin>>x; int t=m+1-x; if(x<t){ if(str[x]=='A')str[t]='A'; else str[x]='A'; ...
C++
eee23388aa7cda50302fc4da6e50e172
141c1dbfc5699475f243c61c73868a86
800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int inf=0x3f3f3f3f; const int maxn=1e6+5; int t,n,m,a; char s[55]; int main() { cin>>t; while(t--){ cin>>n>>m; memset(s,'B',sizeof(s)); while(n--){ cin>>a; if(a<=m/2){ if(s[a]=='B') s[a]='A'; else s[m+1-a]='A'; ...
C++
eee23388aa7cda50302fc4da6e50e172
a716a92a306a3838a2ad37abd9627217
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int test; cin>>test; while(test--) { int n,m; cin>>n>>m; string s="BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"; int a[n],i; for(i=1;i<=n;i++) { cin>>a[i]; } int j,k; for(i=1;i<=n;i++) ...
C++
eee23388aa7cda50302fc4da6e50e172
1a765fd18eac32d3bd2fdd9643078ad6
800
PASSED
#include <bits/stdc++.h> using namespace std; int t, n, h[100010]; long long dp[100010]; int main(){ cin>>t; for (int z=1; z<=t; z++){ long long res=1e18; cin>>n; for (int i=1; i<=n; i++) { cin>>h[i];} for (int i=2; i<=n-1; i++) dp[i]=dp[i-2]+max(0, max(h[i-1], h[i+1])...
C++
ba52f4eaf05c0f154c40cec46c861c13
a07ed690b4989b16732d980ee4e2093a
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int t, n, h[100010]; long long dp[100010]; int main(){ cin>>t; for (int z=1; z<=t; z++){ long long res=1e18; cin>>n; for (int i=1; i<=n; i++) { cin>>h[i];} for (int i=2; i<=n-1; i++) dp[i]=dp[i-2]+max(0, max(h[i-1], h[i+1])...
C++
ba52f4eaf05c0f154c40cec46c861c13
d375cd4e2f4b2ecad801487a6d3fc78a
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int t, n, h[100010]; long long dp[100010]; int main(){ cin>>t; for (int z=1; z<=t; z++){ cin>>n; for (int i=1; i<=n; i++) { cin>>h[i];} for (int i=2; i<=n-1; i++) dp[i]=dp[i-2]+max(0, max(h[i-1], h[i+1])-h[i]+1); if (n%2==1...
C++
ba52f4eaf05c0f154c40cec46c861c13
f863ddfebfc03964e4d768fc2a6ea581
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int t, n, h[100010]; long long dp[100010]; int main(){ cin>>t; for (int z=1; z<=t; z++){ cin>>n; for (int i=1; i<=n; i++) { cin>>h[i];} for (int i=2; i<=n-1; i++) dp[i]=dp[i-2]+max(0, max(h[i-1], h[i+1])-h[i]+1); if (n%2==1...
C++
ba52f4eaf05c0f154c40cec46c861c13
276df6781295dfbb024550a666f76551
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int t, n, h[100010]; long long dp[100010]; int main(){ cin>>t; for (int z=1; z<=t; z++){ cin>>n; for (int i=1; i<=n; i++) cin>>h[i]; for (int i=2; i<=n-1; i++) dp[i]=dp[i-2]+max(0, max(h[i-1], h[i+1])-h[i]+1); if (n%2==1) co...
C++
ba52f4eaf05c0f154c40cec46c861c13
465fd65cc8dabd54a996da16b1cadf71
1,400
PASSED
#include "bits/stdc++.h" using namespace std; #define ll long long const int MAXN = 100100; int t, n; ll a[MAXN]; ll get(int i) { return max(0ll, max(a[i - 1], a[i + 1]) - a[i] + 1); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> t; while (t--) { cin >...
C++
ba52f4eaf05c0f154c40cec46c861c13
e8ac47768f246b015159d650681ae0d7
1,400
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; #define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) const int mod = 1e9 + 7; #define ll long long #define PI 3.141592653589793238462 #define pb push_back #define ppb pop_back #define mp make_pair #define ff first ...
C++
ba52f4eaf05c0f154c40cec46c861c13
86a48fbc59c9bdc6b08c3bbbda7c28b9
1,400
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; #define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) const int mod = 1e9 + 7; #define ll long long #define PI 3.141592653589793238462 #define pb push_back #define ppb pop_back #define mp make_pair #define ff first ...
C++
ba52f4eaf05c0f154c40cec46c861c13
645978242576a310ce42cb8469104abe
1,400
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; #define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) const int mod = 1e9 + 7; #define ll long long #define PI 3.141592653589793238462 #define pb push_back #define ppb pop_back #define mp make_pair #define ff first ...
C++
ba52f4eaf05c0f154c40cec46c861c13
c8588be5b7ae038e87132061c9021fab
1,400
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; #define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) const int mod = 1e9 + 7; #define ll long long #define PI 3.141592653589793238462 #define pb push_back #define ppb pop_back #define mp make_pair #define ff first ...
C++
ba52f4eaf05c0f154c40cec46c861c13
471f9fdb1795af4f9b5056178a705e4c
1,400
PASSED
#include <iostream> #include <string> #include <vector> #include <queue> #include <memory> #include <unordered_map> #include <unordered_set> #include <stack> #include <map> #include <numeric> #include <time.h> #include <numeric> #include <cstdlib> #include <bitset> #include <algorithm> #include <set> ...
C++
60190de3b5ae124d3cdca86fa931f1e0
24a5dc428d98ec490bc649e3ca258149
1,700
PASSED
#include <iostream> #include <string> #include <vector> #include <queue> #include <memory> #include <unordered_map> #include <unordered_set> #include <stack> #include <map> #include <numeric> #include <time.h> #include <numeric> #include <cstdlib> #include <bitset> #include <algorithm> #include <set> ...
C++
60190de3b5ae124d3cdca86fa931f1e0
1175600c66c40a5a1f47962ce8aac3ad
1,700
PASSED
#include <iostream> #include <string> #include <vector> #include <queue> #include <memory> #include <unordered_map> #include <unordered_set> #include <stack> #include <map> #include <numeric> #include <time.h> #include <numeric> #include <cstdlib> #include <bitset> #include <algorithm> #include <set> ...
C++
60190de3b5ae124d3cdca86fa931f1e0
d738ef1a4abe1a9719d1ba2d83e505c0
1,700
PASSED
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <math.h> #include <stdio.h> #include <limits> #include <bitset> #include <cctype> #include <climits> #include <set> #include <queue> #include <chrono> using namespace std; using ll = long long; lo...
C++
60190de3b5ae124d3cdca86fa931f1e0
1ab74906232377f347c827e4956b8c1e
1,700
PASSED
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <iostream> #include <iostream> #include <fstream> #include <string> #include <sstream> #include <vector> #include <algorithm> #include <map> #include <math.h> #include <queue> #include <set> #include <iostream> #include <iomanip> #include...
C++
60190de3b5ae124d3cdca86fa931f1e0
4a817fc2ee842389c9f0e027a8a5d5c8
1,700
PASSED
#include<iostream> #include<algorithm> #include<cstring> const int N = 3e4 + 10; int n, k; int a[N]; bool st[N]; void solve() { memset(st, false, sizeof st); std::cin >> n >> k; for (int i = 1; i <= n; i++)std::cin >> a[i]; if (k > a[n] || n == 1) { std::cout << 0 << '\n'; return; } ...
C++
60190de3b5ae124d3cdca86fa931f1e0
4345e491b61a76bc52ff0e04ce9338ff
1,700
PASSED
#include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N = 3010,INF = 0x3f3f3f3f; int n,k; int a[N]; bool st[N]; int main() { int t;cin >> t; while(t --) { cin >> n >> k; for(int i = 1;i <= n;i ++) cin >> a[i]; if(n ==...
C++
60190de3b5ae124d3cdca86fa931f1e0
a97321b310393cb1af9eb5e776fd7a30
1,700
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <math.h> #include <set> #include <map> #include <stack> #include <queue> #include <deque> #define vi vector <int> #define all(x) x.begin(), x.end() #define vvi vector <vi> using namespace std; void solve(){ int n,...
C++
60190de3b5ae124d3cdca86fa931f1e0
05d04f28560e8e7a259524f9893c3636
1,700
PASSED
#include <iostream> #include <vector> #include <assert.h> #include <unordered_map> #include <algorithm> #include <queue> #include <numeric> #include <map> #include <deque> #include <iomanip> #include <set> #include <stdio.h> using namespace std; using ll = long long; using pii = pair<int, int>; int m...
C++
60190de3b5ae124d3cdca86fa931f1e0
649cb1ccaf0a0992d118a3c36023d9ea
1,700
PASSED
#include <iostream> #include <vector> #include <assert.h> #include <unordered_map> #include <algorithm> #include <queue> #include <numeric> #include <map> #include <deque> #include <iomanip> #include <set> #include <stdio.h> using namespace std; using ll = long long; using pii = pair<int, int>; int m...
C++
60190de3b5ae124d3cdca86fa931f1e0
793fe24175cb532a433e797767f59fb9
1,700
PASSED
/** * ุงู‚ู’ุฑูŽุฃู’ ุจูุงุณู’ู…ู ุฑูŽุจู‘ููƒูŽ ุงู„ู‘ูŽุฐููŠ ุฎูŽู„ูŽู‚ูŽ * ุฎูŽู„ูŽู‚ูŽ ุงู„ู’ุฅูู†ู’ุณูŽุงู†ูŽ ู…ูู†ู’ ุนูŽู„ูŽู‚ู **/ #include<algorithm> #include<iostream> #include<vector> #include<cstring> #include<queue> #include<set> #include<map> #include<stack> #include<iomanip> #include<bitset> #include<climits> #include<functional> usin...
C++
c63640fd70e0268f03cb4eec18540f3a
622afd84bd20b641d90910d976eb9c11
1,100
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--){ int n; cin>>n; vector<vector<int>>v(n+1); for(int i=0;i<n;i++){ int x; ...
C++
c63640fd70e0268f03cb4eec18540f3a
5c949df10a0ada8a053a98cb6db546dd
1,100
PASSED
#include<bits/stdc++.h> #define int long long int using namespace std; vector<vector<int>>v(100000+10); int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--){ int n; cin>>n; for(int i=1;i<=n;i++){ v[i].clear(); ...
C++
c63640fd70e0268f03cb4eec18540f3a
25a897d7f3395768325566e947774b8f
1,100
PASSED
#include<bits/stdc++.h> #define int long long int using namespace std; vector<vector<int>>v(100000+10); int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--){ int n; cin>>n; for(int i=1;i<=n;i++){ v[i].clear(); ...
C++
c63640fd70e0268f03cb4eec18540f3a
2df3d7b8aaeb215d41395de705945fc3
1,100
PASSED